示例#1
0
 public static void Debug(LogEntry logEntry)
 {
     InitializeLogger();
     if (_logLevel == LogLevel.Debug)
     {
         _logger.Debug(logEntry);
     }
 }
示例#2
0
        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);
            }
        }
示例#3
0
 public static void Warning(LogEntry logEntry)
 {
     InitializeLogger();
     if (_logLevel == LogLevel.Warning || _logLevel == LogLevel.Information || _logLevel == LogLevel.Debug)
     {
         _logger.Warning(logEntry);
     }
 }
示例#4
0
 public static void Error(LogEntry logEntry)
 {
     InitializeLogger();
     if (_logLevel == LogLevel.Error || _logLevel == LogLevel.Debug)
     {
         _logger.Error(logEntry);
     }
 }
示例#5
0
 public void Warning(LogEntry entry)
 {
     Trace.TraceWarning(GetLogEntry(entry, LogLevel.Information));
 }
示例#6
0
 public void Info(LogEntry entry)
 {
     Trace.TraceInformation(GetLogEntry(entry, LogLevel.Information));
 }
示例#7
0
 public void Error(LogEntry entry)
 {
     Trace.TraceError(GetLogEntry(entry, LogLevel.Error));
 }
示例#8
0
 public void Debug(LogEntry entry)
 {
     entry.Message = entry.Message;
     Trace.TraceInformation(GetLogEntry(entry, LogLevel.Debug));
 }