private static void LogEvent(NLogger logger, NLogLevel level, string logSource, Exception exception, string message, params object[] parameters) { if (logger.IsEnabled(level)) { var logEvent = new LogEventInfo(level, logger.Name, null, message, parameters, exception); logEvent.Properties["logSource"] = logSource; logger.Log(logEvent); } }
private static void LogEvent(NLogger logger, NLogLevel level, string logSource, Exception exception, object message) { if (logger.IsEnabled(level)) { var logEvent = new LogEventInfo(level, logger.Name, null, "{0}", new[] { message }, exception); logEvent.Properties["logSource"] = logSource; // TODO logSource is the same as logger.Name, now adding twice logEvent.Properties["SourceContext"] = Context?.Sender?.Path?.ToString() ?? string.Empty; // Same as Serilog logger.Log(logEvent); } }
private bool IsEnabled(global::NLog.LogLevel logLevel) { return(_logger.IsEnabled(logLevel)); }
public bool IsEnabled(LogLevel logLevel) { return(_logger.IsEnabled(GetLogLevel(logLevel))); }
public bool GetIsEnabled(LoggingLevel level) { return(nlogLogger.IsEnabled(LoggingLevelMapper.GetNLogLevel(level))); }