Esempio n. 1
0
        protected override void WriteException(IExceptionEntry eventEntry)
        {
            var translator = GetTranslator();

            var data = translator.TranslateException(eventEntry);

            WriteToEventViewer(GetSource(), data, EventLogEntryType.Error);
        }
Esempio n. 2
0
        protected override void WriteException(IExceptionEntry eventEntry)
        {
            var translator = GetTranslator();

            var data = translator.TranslateException(eventEntry);

            WriteToFile(data);
        }
Esempio n. 3
0
        protected override void WriteException(IExceptionEntry eventEntry)
        {
            if (eventEntry != null)
            {
                if (eventEntry.Id == Guid.Empty)
                {
                    eventEntry.Id = Guid.NewGuid();
                }

                var str = Newtonsoft.Json.JsonConvert.SerializeObject(eventEntry);
                PushData(str);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Default implementation, returns the object "as is", this method should be overridden in
 /// case of any customizations required e.g. masking capability addition.
 /// Also think of overriding <seealso cref="FormatTransaction"/>
 /// </summary>
 /// <param name="exceptionEntry">The exception entry to be formatted.</param>
 /// <returns>Formatted exception.</returns>
 public virtual IExceptionEntry FormatException(IExceptionEntry exceptionEntry)
 {
     return(exceptionEntry);
 }
Esempio n. 5
0
        /// <summary>
        /// Formats and translates the exception into an <see cref="IExceptionEntry"/> object.
        /// </summary>
        /// <param name="exception">The exception to format.</param>
        /// <param name="entry">The <see cref="IExceptionEntry"/> object to format.</param>
        /// <returns>The entry object provided with excpetion information added.</returns>
        protected internal virtual IExceptionEntry FormatException(Exception exception, IExceptionEntry entry)
        {
            if (exception.InnerException != null)
            {
                entry.AddInnerExceptionMessage(exception.InnerException.ToString());

                var builder = new StringBuilder();

                var innerException = exception.InnerException;
                builder.AppendLine("----Flattened Exception Data[BEGIN]----");
                while (innerException != null)
                {
                    foreach (var pair in innerException.Data.Cast <DictionaryEntry>())
                    {
                        builder.Append(pair.Key).Append(":").Append(pair.Value).AppendLine("---");
                    }

                    innerException = innerException.InnerException;
                }
                builder.AppendLine("----Flattened Exception Data[END]----");

                entry.AddInnerExceptionMessage(builder.ToString());
            }

            entry.AddMessage(exception.Message);

            entry.Source = exception.Source;

            entry.Type = exception.GetType().Name;

            entry.StackTrace = exception.StackTrace;

            entry.TargetSite = exception.TargetSite == null ? string.Empty : exception.TargetSite.Name;

            if (exception.Data.Count > 0)
            {
                entry.AddMessage("---Main Exception Data---");
                try
                {
                    foreach (var pair in exception.Data.Cast <DictionaryEntry>())
                    {
                        entry.AddMessage(pair.Key + ": " + pair.Value);
                    }
                }
                catch { }
            }

            return(entry);
        }
 public string TranslateException(IExceptionEntry entry)
 {
     return(DumpObject(entry));
 }
Esempio n. 7
0
 protected override void WriteException(IExceptionEntry eventEntry)
 {
     System.Threading.Thread.Sleep(500);
 }
Esempio n. 8
0
 protected abstract void WriteException(IExceptionEntry eventEntry);
Esempio n. 9
0
 protected override IExceptionEntry FormatException(Exception exception, IExceptionEntry entry)
 {
     return(base.FormatException(exception, entry));
 }
Esempio n. 10
0
        public override IExceptionEntry FormatException(IExceptionEntry exceptionEntry)
        {
            exceptionEntry.AddMessage("This extensibility point is really useful!");

            return(base.FormatException(exceptionEntry));
        }
 protected override void WriteException(IExceptionEntry eventEntry)
 {
     throw new Exception("I have failed event log.", new Exception("This is a test.", new Exception("inner most exception message")));
 }