Beispiel #1
0
 public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter)
 {
     if (_contextAccessor != null && _contextAccessor.HttpContext != null)
     {
         if (exception != null)
         {
             _metrics.AddException(new MetricsException(exception, _contextAccessor.HttpContext));
         }
         else if (logLevel == LogLevel.Error || logLevel == LogLevel.Warning)
         {
             _metrics.AddException(new MetricsException(logLevel, formatter(state, exception), _contextAccessor.HttpContext));
         }
     }
 }