Exemple #1
0
 public static void RaiseTestErrors()
 {
     WDAppLog.Debug("Next error is just a test");
     WDAppLog.logCallToMethodStub();
     WDAppLog.Debug("Next error is just a test");
     WDAppLog.logError(ErrorLevel.Debug, "Error test (debug)");
     WDAppLog.Debug("Next error is just a test");
     WDAppLog.logError(ErrorLevel.Error, "Error test (Error)");
     WDAppLog.Debug("Next error is just a test");
     WDAppLog.logError(ErrorLevel.SmallError, "Error test (SmallError)");
     WDAppLog.Debug("Next error is just a test");
     WDAppLog.logError(ErrorLevel.SystemError, "Error test (SystemError)");
     WDAppLog.Debug("Next error is just a test");
     WDAppLog.logError(ErrorLevel.TerminalError, "Error test (TerminalError)");
     WDAppLog.Debug("Next error is just a test");
     WDAppLog.logError(ErrorLevel.Warning, "Error test (Warning)");
     WDAppLog.Debug("Next error is just a test");
     WDAppLog.LogNeverSupposedToBeHere();
     WDAppLog.Debug("Next error is just a test");
     WDAppLog.logException(ErrorLevel.Error, new NotImplementedException("Just a test"));
     WDAppLog.Debug("Next error is just a test");
     WDAppLog.logFileOpenError(ErrorLevel.Error, @"C:\just a test.txt");
     WDAppLog.Debug("Next error is just a test");
     WDAppLog.logFileSaveError(ErrorLevel.Error, @"C:\just a test.txt");
     WDAppLog.Debug("Next error is just a test");
     WDAppLog.logTaggedError(ErrorLevel.Error, "Test error", null, "TEST_TAG");
     WDAppLog.Debug("Next error is just a test");
     WDAppLog.logTaggedError(ErrorLevel.Error, "Test error 2", Misc.LoremIpsum, "TEST_TAG");
     WDAppLog.Debug("Next error is just a test");
     WDAppLog.logError(ErrorLevel.Error, "long (Error)" + Misc.LoremIpsum);
     WDAppLog.Debug("Next error is just a test");
     WDAppLog.Debug(Misc.LoremIpsum);
 }
Exemple #2
0
 /// <summary>
 /// If True, Logs the reason via WDAppLog
 /// </summary>
 public static void LogIfTrue(this Why why,
                              ErrorLevel priority              = ErrorLevel.Error,
                              [CallerLineNumber] int line      = 0,
                              [CallerFilePath] string file     = "",
                              [CallerMemberName] string member = "")
 {
     if (why)
     {
         WDAppLog.logError(priority, why.Reason ?? "(no reason given)", "", line, file, member);
     }
 }
Exemple #3
0
 public static void TryCatchLogged(Action tryBlock,
                                   ErrorLevel errorLevelIfCatch,
                                   [CallerLineNumber] int line      = 0,
                                   [CallerFilePath] string file     = "",
                                   [CallerMemberName] string member = "")
 {
     if (tryBlock != null)
     {
         try
         {
             tryBlock();
         }
         catch (Exception ex)
         {
             WDAppLog.logException(ErrorLevel.Error, ex, line, file, member);
         }
     }
     else
     {
         WDAppLog.logError(ErrorLevel.Warning, "TryCatchLogged was given a null tryBlock", line, file, member);
     }
 }