Esempio n. 1
0
        public bool IsEnabled(InbuiltLogLevel level)
        {
            switch (level)
            {
            case InbuiltLogLevel.Information:
            {
                return(_logger.IsEnabled(Serilog.Events.LogEventLevel.Information));
            }

            case InbuiltLogLevel.Debug:
            {
                return(_logger.IsEnabled(Serilog.Events.LogEventLevel.Debug));
            }

            case InbuiltLogLevel.Warning:
            {
                return(_logger.IsEnabled(Serilog.Events.LogEventLevel.Warning));
            }

            case InbuiltLogLevel.Error:
            {
                return(_logger.IsEnabled(Serilog.Events.LogEventLevel.Error));
            }

            case InbuiltLogLevel.Fatal:
            {
                return(_logger.IsEnabled(Serilog.Events.LogEventLevel.Fatal));
            }
            }
            return(false);
        }
Esempio n. 2
0
 private static void LogInternal(InbuiltLogger logger, InbuiltLogLevel level, Exception exception, string format, object[] objects)
 {
     if (logger.IsEnabled(level))
     {
         logger.Log(level, exception, format, objects);
     }
 }
Esempio n. 3
0
        public void Log(InbuiltLogLevel level, Exception exception, string format, params object[] args)
        {
            string message = format;

            if (args != null && args.Length > 0)
            {
                message = string.Format(format, args);
            }

            string log = string.Format("{0} [{1}] {2} {3}", DateTime.Now.ToString("hh:mm:ss.ffff tt"), Thread.CurrentThread.ManagedThreadId, level, message);

            Console.WriteLine(log);

            if (exception != null)
            {
                Console.WriteLine(exception);
            }
        }
Esempio n. 4
0
        public void Log(InbuiltLogLevel level, Exception exception, string format, params object[] args)
        {
            if (IsEnabled(level) == false)
            {
                return;
            }
            switch (level)
            {
            case InbuiltLogLevel.Information:
            {
                _logger.Information(exception, format, args);
                break;
            }

            case InbuiltLogLevel.Debug:
            {
                _logger.Debug(exception, format, args);
                break;
            }

            case InbuiltLogLevel.Warning:
            {
                _logger.Warning(exception, format, args);
                break;
            }

            case InbuiltLogLevel.Error:
            {
                _logger.Error(exception, format, args);
                break;
            }

            case InbuiltLogLevel.Fatal:
            {
                _logger.Fatal(exception, format, args);
                break;
            }
            }
        }
Esempio n. 5
0
 public bool IsEnabled(InbuiltLogLevel level)
 {
     return(true);
 }
Esempio n. 6
0
 public void Log(InbuiltLogLevel level, Exception exception, string format, params object[] args)
 {
     // Hola
 }