<commit_before>﻿/*
 * Copyright (c) 2016 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
// [START complete]

using Google.Logging.V2;
using Google.Logging.Type;
using System;
using System.IO;
using System.Collections.Generic;
using Google.Api;
using Google.Api.Gax.Grpc;

namespace GoogleCloudSamples
{
    public class LoggingSample
    {
        private static readonly string s_projectId = "YOUR-PROJECT-ID";

        private static readonly string s_usage =
                "Usage: \n" +
                "  LoggingSample create-log-entry log-id new-log-entry-text\n" +
                "  LoggingSample list-log-entries log-id\n" +
                "  LoggingSample create-sink sink-id log-id\n" +
                "  LoggingSample list-sinks\n" +
                "  LoggingSample update-sink sink-id log-id\n" +
                "  LoggingSample delete-log log-id\n" +
                "  LoggingSample delete-sink sink-id \n";

        private CallSettings RetryAWhile
        {
            get
            {
                return CallSettings.FromCallTiming(CallTiming.FromExpiration(
                    Google.Api.Gax.Expiration.FromTimeout(
                        TimeSpan.FromSeconds(20))));
            }
        }<commit_msg>Actually retry the RPCs on internal error.<commit_after>﻿/*
 * Copyright (c) 2016 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
// [START complete]

using Google.Logging.V2;
using Google.Logging.Type;
using System;
using System.IO;
using System.Collections.Generic;
using Google.Api;
using Google.Api.Gax.Grpc;

namespace GoogleCloudSamples
{
    public class LoggingSample
    {
        private static readonly string s_projectId = "YOUR-PROJECT-ID";

        private static readonly string s_usage =
                "Usage: \n" +
                "  LoggingSample create-log-entry log-id new-log-entry-text\n" +
                "  LoggingSample list-log-entries log-id\n" +
                "  LoggingSample create-sink sink-id log-id\n" +
                "  LoggingSample list-sinks\n" +
                "  LoggingSample update-sink sink-id log-id\n" +
                "  LoggingSample delete-log log-id\n" +
                "  LoggingSample delete-sink sink-id \n";

        private CallSettings RetryAWhile
        {
            get
            {
                return CallSettings.FromCallTiming(CallTiming.FromRetry(new RetrySettings(
                    new BackoffSettings(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(10), 2.0),
                    new BackoffSettings(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10)),
                    Google.Api.Gax.Expiration.FromTimeout(TimeSpan.FromSeconds(30)),
                    (Grpc.Core.RpcException e) => e.Status.StatusCode == Grpc.Core.StatusCode.Internal
                    )));
            }
        }
{'fraction_non_alphanumeric': 0.08911405559885685, 'fraction_numerical': 0.00805404001039231, 'mean_word_length': 2.246205733558179, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2721622', 'n_tokens_mistral': 1093, 'n_tokens_neox': 1043, 'n_words': 317}