コード例 #1
0
ファイル: PowerShell.cs プロジェクト: TheHunter/Galactic
 // ---------- 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>
 private static 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;
     }
 }
コード例 #2
0
ファイル: SqlUtility.cs プロジェクト: TheHunter/Galactic
 // ---------- CONSTRUCTORS ----------
 // ---------- 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>
 protected virtual bool LogException(Exception e, EventLog.EventLog log)
 {
     if (log != null)
     {
         log.Log(new Event(typeof(SqlUtility).FullName, DateTime.Now, Event.SeverityLevels.Error, e.GetType().FullName,
             "Description:\n" +
            e.Message + "\n" +
            "Stack Trace:\n" +
            e.StackTrace));
         return true;
     }
     else
     {
         return false;
     }
 }