public void WriteErrorMessage(string action, VmBackupEventId eventId, Exception e, params object[] args) { string message = VmBackupEventLogMessages.GetMessage(eventId, args); StringBuilder builder = new StringBuilder(); builder.Append("Action: "); builder.AppendLine(action); builder.AppendLine(); builder.Append("Message: "); builder.AppendLine(message); while (e != null) { builder.AppendLine(); builder.Append("Exception Type: "); builder.AppendLine(e.GetType().ToString()); builder.AppendLine(); builder.Append("Exception Message: "); builder.AppendLine(e.Message); builder.AppendLine(); builder.Append("Stack Trace: "); builder.AppendLine(e.StackTrace); e = e.InnerException; } log.WriteEntry(builder.ToString(), EventLogEntryType.Error, (int)eventId); }
public static string GetMessage(VmBackupEventId eventId, params object[] args) { return(String.Format(dictionary[eventId], args)); }
public void WriteInformationMessage(string action, string message, VmBackupEventId eventId) { log.WriteEntry(message, EventLogEntryType.Information, (int)eventId); }
public void WriteWarningMessage(string action, string message, VmBackupEventId eventId) { log.WriteEntry(message, EventLogEntryType.Warning, (int)eventId); }