private void NLogThread(int count, global::NLog.Logger logger) { for (int i = 0; i < count; i++) { logger.Debug(string.Format("Test logging message {0} NLog, Thread Id:{1}", i, Thread.CurrentThread.ManagedThreadId)); } }
/// <summary> /// 记录日志 /// </summary> /// <param name="loggerLevels">日志级别</param> /// <param name="message">日志消息</param> public override void Log(LoggerLevels loggerLevels, object message) { switch (loggerLevels) { case LoggerLevels.Trace: _logger.Trace(message); break; case LoggerLevels.Debug: _logger.Debug(message); break; case LoggerLevels.Info: _logger.Info(message); break; case LoggerLevels.Warn: _logger.Warn(message); break; case LoggerLevels.Error: _logger.Error(message); break; case LoggerLevels.Fatal: _logger.Fatal(message); break; default: break; } ExcutedOnLog(loggerLevels, message); }
private void Debug(string?message, [CallerMemberName] string?previousMethodName = null, [CallerLineNumber] int callermemberlineNo = 0, [CallerFilePath] string?calledFilePath = null) { if (string.IsNullOrEmpty(message)) { NullError(nameof(message)); return; } LogModule?.Debug($"{previousMethodName}() {message}"); }
/// <summary> /// 写入日志 /// </summary> /// <param name="info"></param> protected override void Write(T info) { switch (info.Sevenrity) { case Sevenrity.Debug: if (_logger.IsDebugEnabled) { _logger.Debug(info); } break; case Sevenrity.Error: if (_logger.IsErrorEnabled) { _logger.Error(info); } break; case Sevenrity.Fatal: if (_logger.IsFatalEnabled) { _logger.Fatal(info); } break; case Sevenrity.Info: if (_logger.IsInfoEnabled) { _logger.Info(info); } break; case Sevenrity.Trace: if (_logger.IsWarnEnabled) { _logger.Info(info); } break; case Sevenrity.Warn: if (_logger.IsWarnEnabled) { _logger.Warn(info); } break; } }
public void Nlog() { try { LogManager.Configuration = new XmlLoggingConfiguration("Regular.config"); } catch (FileNotFoundException) { LogManager.Configuration = new XmlLoggingConfiguration("./test/AWS.Logger.NLog.Tests/Regular.config"); } global::NLog.Logger logger = LogManager.GetLogger("loggerRegular"); for (int i = 0; i < 10; i++) { logger.Debug(string.Format("Test logging message {0} NLog, Thread Id:{1}", i, Thread.CurrentThread.ManagedThreadId)); } string region = "us-west-2"; string logGroupName = "AWSNLogGroup"; Thread.Sleep(10000); AmazonCloudWatchLogsClient client = new AmazonCloudWatchLogsClient( Amazon.RegionEndpoint.GetBySystemName(region)); DescribeLogStreamsResponse describeLogstreamsResponse = client.DescribeLogStreamsAsync(new DescribeLogStreamsRequest { Descending = true, LogGroupName = logGroupName, OrderBy = "LastEventTime" }).Result; GetLogEventsResponse getLogEventsResponse = client.GetLogEventsAsync(new GetLogEventsRequest { LogGroupName = logGroupName, LogStreamName = describeLogstreamsResponse.LogStreams[0].LogStreamName }).Result; Assert.Equal(10, getLogEventsResponse.Events.Count()); }
public void Debug(string msg) => nLogger.Debug(msg);
public void Debug(string message) { logger.Debug(message); }
public void Debug(string text) { Logger.Debug(text); }
/// <inheritdoc/> public void Debug(string message) => _log.Debug(message);
public void Debug(LogOutputProvider messageProvider) { _log.Debug(ToGenerator(messageProvider)); }