private static void Log(ILogMessage message) { if (string.IsNullOrEmpty(LogFilePath)) { System.IO.Directory.CreateDirectory("log"); LogFilePath = string.Format("log/wiki_log_{0}.txt", DateTimeOffset.Now.ToUnixTimeSeconds()); } Console.WriteLine(message.ToString()); System.IO.File.AppendAllText(LogFilePath, message.ToString() + Environment.NewLine); }
private void OnLog(ILogMessage message) { if (Log is null) { Console.WriteLine(message.ToString()); } else { Log(message); } }
public override void Log(ILogMessage message) { switch (message.Level) { case LogLevel.Debug: _logger.LogDebug(message.ToString()); break; case LogLevel.Verbose: _logger.LogTrace(message.ToString()); break; case LogLevel.Information: _logger.LogInformation(message.ToString()); break; case LogLevel.Minimal: _logger.LogTrace(message.ToString()); break; case LogLevel.Warning: _logger.LogWarning(message.ToString()); break; case LogLevel.Error: _logger.LogError(message.ToString()); break; } }
private static void GlobalLoggerOnGlobalMessageLogged(ILogMessage logMessage) { if (logMessage.Type <= LogMessageType.Warning) { return; } LogRingbuffer.Enqueue(logMessage.ToString()); while (LogRingbuffer.Count > 5) { LogRingbuffer.TryDequeue(out _); } }
public void Log(ILogMessage message) => _log.LogMessage(message.ToString());
public void Log(ILogMessage message) { Log(message.Level, message.ToString()); }