Пример #1
0
 public void ExceptionDataTest()
 {
     var ex = new Exception();
     ex.Data.Add("data2", "data container");
     Assert.AreEqual(true, ex.GetExceptionText(includeData: true).Contains("data2"));
     Assert.AreEqual(true, ex.GetExceptionText(includeData: true).Contains("data container"));
 }
Пример #2
0
 /// <summary>
 /// Add log message from exception with catcher information
 /// </summary>
 /// <param name="ex">Exception to log</param>
 /// <param name="whereCathed">Cather information (e.g. function name)</param>
 public static void Add(Exception ex, string whereCathed)
 {
     Add(string.Format(WhereCatchedFormat, whereCathed, ex.GetExceptionText()));
 }
Пример #3
0
 /// <summary>
 /// Add log message from exception
 /// </summary>
 /// <param name="ex">Exception to log</param>
 public static void Add(Exception ex)
 {
     Add(ex.GetExceptionText());
 }
Пример #4
0
 /// <summary>
 /// Add log message from exception to session
 /// </summary>
 /// <param name="session">Session identifier</param>
 /// <param name="ex">Exception to log</param>
 public static void Add(Guid session, Exception ex)
 {
     Add(session, ex.GetExceptionText());
 }
Пример #5
0
        private string GetExceptionText(string whereCatched, Exception ex)
        {
            return ex.GetExceptionText($"{GetType().Name}.{whereCatched}()"
#if !DEBUG
                , clearText: true, includeData: false, includeStackTrace: false
#endif

                );
        }
Пример #6
0
 /// <summary>
 /// Add log message from exception with catcher information
 /// </summary>
 /// <param name="ex">Exception to log</param>
 /// <param name="whereCathed">Cather information (e.g. function name)</param>
 public static void Add(Exception ex, string whereCathed = null)
 {
     Add(ex.GetExceptionText(), whereCathed);
 }