Example #1
0
        /// <summary>
        /// Writes the given exception to the log along with a reference number.
        /// It will return the reference number to the caller.
        /// If message cannot be written to log or the failover file, then an
        /// exception will be thrown back to the caller containing the original exception
        /// for items with critical priority.
        /// </summary>
        /// <param name="e">An exception object or derived exception object to log</param>
        /// <param name="enumPriority">The priority of the item to log. A critical item will
        /// throw an exception if it is not possbile to write to the primary and backup logs</param>
        /// <returns>Unique reference number which can be used to view the logged message</returns>
        public virtual Int64 WriteToLog(Exception e, enumEventPriority enumPriority)
        {
            if (e is ExceptionEvent)
            {
                return(WriteToLog(((ExceptionEvent)e).ToString()
                                  , EventLogEntryType.Error
                                  , enumPriority));
            }

            return(WriteToLog(ExceptionEvent.ConvertExceptionToString(e)
                              , EventLogEntryType.Error
                              , enumPriority));
        }