Esempio n. 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);
 }
Esempio n. 2
0
        public void setUndoPoint(string name, DOCUMENT_TYPE obj)
        {
            //undoBuffer is inactive if maxUndo is set to 0
            if (maxUndo == 0)
            {
                return;
            }

            redoBuffer.Clear();
            if (undoBuffer.Count >= maxUndo)
            {
                if (undoBuffer.Count > 0)
                {
                    //undoBuffer.Pop();
                    undoBuffer.Dequeue();
                }
            }
            try
            {
                undoBuffer.Push(new UndoEvent(name, obj));
            }
            catch (System.InvalidOperationException ex)
            {
                WDAppLog.logError(ErrorLevel.Error, "Undo is failing, critical memory shortage is likely", ex.Message);
            }
        }
Esempio n. 3
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);
     }
 }
Esempio n. 4
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);
     }
 }