コード例 #1
0
ファイル: LoggerExtensions.cs プロジェクト: lulzzz/piraeus-1
        internal static IClientBuilder AddLoggers(this IClientBuilder clientBuilder, PiraeusGatewayOptions options)
        {
            clientBuilder.ConfigureLogging(builder =>
            {
                if (options.LoggerTypes.HasFlag(LoggerType.Console) && options.LoggingLevel != LogLevel.None)
                {
                    builder.AddConsole();
                }

                if (options.LoggerTypes.HasFlag(LoggerType.Debug) && options.LoggingLevel != LogLevel.None)
                {
                    builder.AddDebug();
                }

                if (options.LoggingLevel != LogLevel.None)
                {
                    builder.SetMinimumLevel(options.LoggingLevel);
                }
            });

            if (options.LoggingLevel.HasFlag(LoggerType.AppInsights) && options.LoggingLevel != LogLevel.None && !string.IsNullOrEmpty(options.AppInsightKey))
            {
                clientBuilder.AddApplicationInsightsTelemetryConsumer(options.AppInsightKey);
            }

            return(clientBuilder);
        }
コード例 #2
0
        private static IClientBuilder AddOrleansClusterClient(this IClientBuilder builder, OrleansConfig config)
        {
            builder.ConfigureApplicationParts(parts => parts.AddApplicationPart(typeof(IPiSystem).Assembly));

#if DEBUG
            builder.UseLocalhostClustering();
#else
            builder.Configure <ClusterOptions>(options =>
            {
                options.ClusterId = config.ClusterId;
                options.ServiceId = config.ServiceId;
            });

            if (config.DataConnectionString.Contains("6379") || config.DataConnectionString.Contains("6380"))
            {
                builder.UseRedisGatewayListProvider(options => options.ConnectionString = config.DataConnectionString);
            }
            else
            {
                builder.UseAzureStorageClustering(options => options.ConnectionString = config.DataConnectionString);
            }
#endif

            LoggerType loggers = config.GetLoggerTypes();

            if (loggers.HasFlag(LoggerType.AppInsights))
            {
                builder.AddApplicationInsightsTelemetryConsumer(config.InstrumentationKey);
            }

            builder.ConfigureLogging(op =>
            {
                if (loggers.HasFlag(LoggerType.AppInsights))
                {
                    op.AddApplicationInsights(config.InstrumentationKey);
                    op.SetMinimumLevel(Enum.Parse <LogLevel>(config.LogLevel, true));
                }

                if (loggers.HasFlag(LoggerType.Console))
                {
                    op.AddConsole();
                    op.SetMinimumLevel(Enum.Parse <LogLevel>(config.LogLevel, true));
                }

                if (loggers.HasFlag(LoggerType.Debug))
                {
                    op.AddDebug();
                    op.SetMinimumLevel(Enum.Parse <LogLevel>(config.LogLevel, true));
                }
            });

            return(builder);
        }
コード例 #3
0
 internal static IClientBuilder Configure(IClientBuilder clientBuilder)
 {
     return(clientBuilder.ConfigureLogging(loggingBuilder =>
     {
         loggingBuilder.SetMinimumLevel(LogLevel.Information);
         loggingBuilder.AddDebug();
     })
            .ConfigureApplicationParts(parts =>
     {
         parts.AddApplicationPart(typeof(BaseIndexingFixture).Assembly);
     }));
 }
コード例 #4
0
        private IClientBuilder AddLoggers(IClientBuilder builder, LoggerType loggers, LogLevel logLevel, string instrumentationKey = null)
        {
            builder.ConfigureLogging(op =>
            {
                if (loggers.HasFlag(Piraeus.Configuration.LoggerType.Console))
                {
                    op.AddConsole();
                    op.SetMinimumLevel(logLevel);
                }

                if (loggers.HasFlag(Piraeus.Configuration.LoggerType.Debug))
                {
                    op.AddDebug();
                    op.SetMinimumLevel(logLevel);
                }
            });

            return(builder);
        }
コード例 #5
0
ファイル: GraphManager.cs プロジェクト: lulzzz/piraeus-2
        private IClientBuilder AddLoggers(IClientBuilder builder, LoggerType loggers, LogLevel logLevel)
        {
            builder.ConfigureLogging(op =>
            {
                if (loggers.HasFlag(LoggerType.Console))
                {
                    op.AddConsole();
                    op.SetMinimumLevel(logLevel);
                }

                if (loggers.HasFlag(LoggerType.Debug))
                {
                    op.AddDebug();
                    op.SetMinimumLevel(logLevel);
                }
            });

            return(builder);
        }
コード例 #6
0
 public void Configure(IConfiguration configuration, IClientBuilder clientBuilder)
 {
     clientBuilder.ConfigureLogging(log => log.AddTestDebugLogging());
 }