/// <summary> /// Logs an exception to the event log. /// </summary> /// <param name="e">The exception to log.</param> /// <param name="log">The event log to log the execption to.</param> /// <returns>True if the exception was logged successfully. False otherwise.</returns> protected override bool LogException(Exception e, EventLog.EventLog log) { if (log != null) { log.Log(new Event(typeof(MongoDBUtility).FullName, DateTime.Now, Event.SeverityLevels.Error, e.GetType().FullName, "Description:\n" + e.Message + "\n" + "Stack Trace:\n" + e.StackTrace)); return(true); } else { return(false); } }
// ---------- METHODS ---------- /// <summary> /// Logs an exception to the event log. /// </summary> /// <param name="e">The exception to log.</param> /// <param name="log">The event log to log the execption to.</param> /// <returns>True if the exception was logged successfully. False otherwise.</returns> static private bool LogException(Exception e, EventLog.EventLog log) { if (log != null) { log.Log(new Event(typeof(PowerShell).FullName, DateTime.Now, Event.SeverityLevels.Error, e.GetType().FullName, "Description:\n" + e.Message + "\n" + "Stack Trace:\n" + e.StackTrace)); return(true); } else { return(false); } }