public static void Debug(LogEntry logEntry) { InitializeLogger(); if (_logLevel == LogLevel.Debug) { _logger.Debug(logEntry); } }
private string GetLogEntry(LogEntry entry, LogLevel level) { try { string log = string.Format("{0}\t[{1}]\t[{2}]\t[{3}]\t{4}\t{5}ms\t{6}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffff"), entry.Source, entry.ThreadId, level.ToString(), entry.Message, entry.EllapsedMilliseconds, entry.CorrelationId != Guid.Empty ? entry.CorrelationId.ToString() : ""); return log; } catch (Exception e) { return string.Format("Error while generating log information, {0}", e); } }
public static void Warning(LogEntry logEntry) { InitializeLogger(); if (_logLevel == LogLevel.Warning || _logLevel == LogLevel.Information || _logLevel == LogLevel.Debug) { _logger.Warning(logEntry); } }
public static void Error(LogEntry logEntry) { InitializeLogger(); if (_logLevel == LogLevel.Error || _logLevel == LogLevel.Debug) { _logger.Error(logEntry); } }
public void Warning(LogEntry entry) { Trace.TraceWarning(GetLogEntry(entry, LogLevel.Information)); }
public void Info(LogEntry entry) { Trace.TraceInformation(GetLogEntry(entry, LogLevel.Information)); }
public void Error(LogEntry entry) { Trace.TraceError(GetLogEntry(entry, LogLevel.Error)); }
public void Debug(LogEntry entry) { entry.Message = entry.Message; Trace.TraceInformation(GetLogEntry(entry, LogLevel.Debug)); }