コード例 #1
0
        public static ILogger Create()
        {
            var log = new LoggerConfiguration()
                .Enrich.WithProcessId()
                .Enrich.WithThreadId()
                .WriteTo.Seq("http://localhost:5341")
                .MinimumLevel.Debug()
                .CreateLogger();


            var logger = new SerilogLogger(log);
            return logger;
        }
コード例 #2
0
        private static ILogger CreateLogger()
        {
            var log = new LoggerConfiguration()
                .Enrich.WithProcessId()
                .Enrich.WithThreadId()
                .Enrich.With<TestIdEnricher>()
                .Enrich.With<TestNameEnricher>()
                .Enrich.With<NimbusMessageEnricher>()
                .Enrich.WithExceptionDetails()
                .WriteTo.Seq("http://localhost:5341")
                .Chain(l => { if (Debugger.IsAttached) l.WriteTo.Trace(); })
                .MinimumLevel.Verbose()
                .CreateLogger();

            Log.Logger = log;

            var logger = new SerilogLogger(log);
            return logger;
        }