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); }
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); } }