public static void InitializeLogger()
        {
            SqlCommandLogObserver = new SqlCommandsObserver();

            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Information()         // > Level (INFO, DEBUG, WARN, ERROR, FATAL)
                         .WriteTo.Console()                  // => Console
                         .WriteTo.File("Serilog.log")        // => File
                         .WriteTo.Observers(events => events // => SqlCommandLogObserver
                                            .Subscribe(SqlCommandLogObserver))
                         .CreateLogger();
        }
        public static void InitializeLogger()
        {
            SqlCommandsLogObserver = new SqlCommandsObserver();

            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Information()
                         //.WriteTo.Console()
                         .WriteTo.File("Serilog.log")
                         .WriteTo.Observers(events =>
                                            events
                                            .Subscribe(SqlCommandsLogObserver))
                         .CreateLogger();
        }
示例#3
0
 public static void InitializeLogger()
 {
     SqlCommandLogObserver = new SqlCommandsObserver();
     Log.Logger            = new LoggerConfiguration()
                             .MinimumLevel.Debug()
                             // Log-Meldungen des Entity Frameworks filtern:
                             .MinimumLevel.Override("Microsoft", LogEventLevel.Error)
                             .WriteTo.Console()
                             .WriteTo.File("Serilog.log")
                             .WriteTo.Observers(events => events
                                                .Subscribe(SqlCommandLogObserver))
                             .CreateLogger();
 }