Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 public static string GetMessage(VmBackupEventId eventId, params object[] args)
 {
     return(String.Format(dictionary[eventId], args));
 }
Ejemplo n.º 3
0
 public void WriteInformationMessage(string action, string message, VmBackupEventId eventId)
 {
     log.WriteEntry(message, EventLogEntryType.Information, (int)eventId);
 }
Ejemplo n.º 4
0
 public void WriteWarningMessage(string action, string message, VmBackupEventId eventId)
 {
     log.WriteEntry(message, EventLogEntryType.Warning, (int)eventId);
 }