コード例 #1
0
ファイル: MongoDBUtility.cs プロジェクト: trungpv/Galactic
 /// <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);
     }
 }
コード例 #2
0
ファイル: PowerShell.cs プロジェクト: trungpv/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>
        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);
            }
        }