/// <inheritdoc />
            public void Log <TState>(global::Microsoft.Extensions.Logging.LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter)
            {
                if (!IsEnabled(logLevel))
                {
                    return;
                }

                if (formatter == null)
                {
                    throw new ArgumentNullException(nameof(formatter));
                }

                var splatLogLevel = MsLoggingHelpers.MsLog2SplatDictionary[logLevel];

                var message = formatter(state, exception);

                LogHost.Default.Write(exception, message, splatLogLevel);
            }
Ejemplo n.º 2
0
 public MockActualMicrosoftExtensionsLoggingLogger(global::Microsoft.Extensions.Logging.LogLevel logLevel)
 {
     _logLevel = logLevel;
 }
 /// <inheritdoc />
 public bool IsEnabled(global::Microsoft.Extensions.Logging.LogLevel logLevel)
 {
     return(logLevel != global::Microsoft.Extensions.Logging.LogLevel.None);
 }
Ejemplo n.º 4
0
 private LogLevel Convert(global::Microsoft.Extensions.Logging.LogLevel logLevel)
 => logLevel switch
 {