Beispiel #1
0
        public static ILogger CreateSerilogger(this IConfiguration config, Action <LoggerConfiguration> setupAction = null, string sourceContext = "Startup")
        {
            Console.WriteLine("CreateSerilogger");
            var loggerConfig = new LoggerConfiguration();

            loggerConfig.ConfigureSerilog(config, setupAction);
            var logger = loggerConfig.CreateLogger()
                         .ForContext(Constants.SourceContextPropertyName, sourceContext);

            Log.Logger = logger;
            return(logger);
        }