コード例 #1
0
 public static void DumpLogEntry(LogEntry logEntry)
 {
     Console.WriteLine("           Log message: {0}", logEntry.Message);
     Console.WriteLine("             Logged by: {0}", logEntry.MessageSource);
     Console.WriteLine("           Source Guid: {0}", logEntry.SourceGuid);
 }
コード例 #2
0
 void LogBase(LogEntry logEntry, string message, params object[] args)
 {
     logEntry.Message = string.Format(message, args);
     logEntry.MessageSource = new DbWhoWhenWhere(true);
     try
     {
         Context.Log.Local.Add(logEntry);
     }
     catch (Exception e)
     {
         Debug.WriteLine("{0}: Caught (and discarded) exception from LogBase: {1}", DateTime.Now, e.Message);
         Debug.WriteLine("{0}:   Log message causing exception: {1}", DateTime.Now, logEntry.Message);
     }
 }