public void Setup()
        {
            Log.SetVerbosity(MsgLevel.Info);
            Log.SetMsgNumberThreshold(1);
            Log.SetStackTools(new StackTools());
            WrapErr.InitialiseOnExceptionLogDelegate(Log.LogExceptionDelegate);

            this.consoleWriter.StartLogging();
        }
        public void SetupTest()
        {
            //TestHelpers.SetSingleLineException();

            this.logged         = false;
            this.msgFormated    = false;
            this.finallyInvoked = false;

            WrapErr.InitialiseOnExceptionLogDelegate(this.LogDelegate);
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="level">Log level verbosity</param>
        /// <param name="numberOfMsgBeforeDumpToLog">How many messages are put out before they are dumped to log</param>
        public HelperLogReader(MsgLevel level, int numberOfMsgBeforeDumpToLog)
        {
            // Create delegate to attach to Log
            this.myLogReadDelegate = new LogingMsgEventDelegate(this.Log_OnLogMsgEvent);

            // Set log verbosity and number of messages that have to arrive before the log
            // thread fires
            Log.SetVerbosity(level);
            Log.SetMsgNumberThreshold(numberOfMsgBeforeDumpToLog);

            // Stream the errors caught by WrapErr to the Log
            WrapErr.InitialiseOnExceptionLogDelegate(Log.LogExceptionDelegate);
        }
Esempio n. 4
0
        public void OnFunction_Exception_NoLogging()
        {
            WrapErr.InitialiseOnExceptionLogDelegate(null);
            string s = "lalala";

            WrapErr.ToErrReport(out ErrReport err, 1111, "Validate arg", () => {
                s = WrapErr.ToErrorReportException(12345, "Unexpected Error Processing Block", () => {
                    new ChkUtilsTestHelpers.OuterClass().DoNestedException();
                    return("This should not be");
                });
            });
            this.Validate(err, 12345, "OnFunction_Exception_NoLogging", "Unexpected Error Processing Block");
            Assert.AreEqual("lalala", s);
            Assert.IsFalse(this.logged, "Exception - But the logger should not have been fired");
        }