Esempio n. 1
0
        protected void FailSafeLog(Exception ex)
        {
            if (ex == null)
            {
                throw new ArgumentNullException("ex");
            }

            FailSafeLogFactory.Log(ex);
        }
Esempio n. 2
0
        public virtual void Write(ILogEntry entry, string category)
        {
            try
            {
                if (!CheckSectionStatus(entry))
                {
                    return;
                }

                var loggers = GetLoggers(category);

                if (entry is TransactionEntry)
                {
                    var eventEntry = (ITransactionEntry)entry;
                    entry = FormattingFactory.CurrentFormatter.FormatTransaction(eventEntry);
                }
                else if (entry is EventEntry)
                {
                    var eventEntry = (IEventEntry)entry;
                    entry = FormattingFactory.CurrentFormatter.FormatEvent(eventEntry);
                }
                else
                {
                    var eventEntry = (IExceptionEntry)entry;
                    entry = FormattingFactory.CurrentFormatter.FormatException(eventEntry);
                }

                foreach (var logger in loggers)
                {
                    logger.Write(entry);
                }
            }
            catch (LogException)
            {
                throw;
            }
            catch (Exception ex)
            {
                FailSafeLogFactory.Log(ex);
            }
        }