예제 #1
0
        private static Logger CreateLogger(ExecutionEnvironment environment, string version, string tenant)
        {
            const string processName = @"FunFair.Labs.ScalingEthereum.Server";

            LoggerConfiguration configuration = new LoggerConfiguration().MinimumLevel.ControlledBy(_loggingLevelSwitch)
                                                .Enrich.FromLogContext()
                                                .Enrich.WithMachineName()
                                                .Enrich.WithProcessId()
                                                .Enrich.WithThreadId()
                                                .Enrich.WithProperty(name: @"Environment", environment.GetName())
                                                .Enrich.WithProperty(name: @"ServerVersion", value: version)
                                                .Enrich.WithProperty(name: @"ProcessName", value: processName)
                                                .Enrich.WithProperty(name: @"Tenant", value: tenant)
                                                .WriteTo.Console(LogEventLevel.Information);

            if (!environment.IsLocalOrTest())
            {
                configuration = configuration.WriteTo.Loggly();
            }

            return(configuration.CreateLogger());
        }