Esempio n. 1
0
        /// <summary>
        /// Instance method to write an exception in the event log. Construct string with messages and stack trace from the exception
        /// and all inner exceptions(message and stack trace included).
        /// </summary>
        /// <param name="exception"></param>
        protected virtual void WriteExceptionToEventLog(Exception exception)
        {
            Exception result;

            var appId = this.GetApplicationIdentity();

            AbstractLogger.TryWriteExceptionToEventLog(appId, exception, out result);
        }
        /// <summary>
        /// Write the exception to Unity event log
        /// </summary>
        /// <param name="exceptionToLog"></param>
        public static bool WriteExceptionToEventLog(Exception exceptionToLog)
        {
            if (_applicationName == null)
            {
                _applicationName = GetApplicationName();
            }

            Exception resultException;

            var result = AbstractLogger.TryWriteExceptionToEventLog(_applicationName ?? string.Empty, exceptionToLog, out resultException);

            return(result);
        }