Beispiel #1
0
        public static void Setup(WebHostBuilderContext _, LoggerConfiguration config)
        {
            var           elasticUrl = EnvVariable.Get(EnvVariables._ElasticUrl);
            LogEventLevel logLevel   = LogEventLevel.Warning;

            if (Enum.TryParse(EnvVariable.TryGet(EnvVariables._LogLevel), true, out LogEventLevel level))
            {
                logLevel = level;
            }

            config
            .MinimumLevel.Is(logLevel)
            .Enrich.FromLogContext()
            .WriteTo.Console()
            .WriteTo.Elasticsearch(new ElasticsearchSinkOptions(new Uri(elasticUrl))
            {
                IndexFormat = $"{RoleNames._AuthorityService}-logs-{DateTime.UtcNow:yyyy-MM}"
            });
        }
 public static void Setup(ApplicationInsightsServiceOptions options)
 {
     options.InstrumentationKey     = EnvVariable.TryGet(EnvVariables._AppInsightsKey);
     options.EnableAdaptiveSampling = false;
     options.EnableDebugLogger      = false;
 }