Example #1
0
        public void ExplicitCloseWins()
        {
            IDefaultActivityLogger l = DefaultActivityLogger.Create();

            // Binds the TestHelper.Logger logger to this one.
            l.Output.RegisterMuxClient(TestHelper.Logger.Output.ExternalInput);

            var log = new StringImpl();

            l.Register(log);

            // No explicit close conclusion: Success!
            using (l.OpenGroup(LogLevel.Trace, () => "Success!", "First"))
            {
                l.Error("Pouf");
            }
            Assert.That(log.Writer.ToString(), Is.StringContaining("Pouf"));
            Assert.That(log.Writer.ToString(), Is.Not.StringContaining("Failed!"), "Default conclusion wins.");
            Assert.That(log.Writer.ToString(), Is.StringContaining("Success!"), "Default conclusion.");

            log.Writer.GetStringBuilder().Clear();
            Assert.That(log.Writer.ToString(), Is.Empty);

            // Explicit conclusion: Failed!
            using (l.OpenGroup(LogLevel.Trace, () => "Success!", "First"))
            {
                l.Error("Pouf");
                l.CloseGroup("Failed!");
            }
            Console.WriteLine(log.Writer.ToString());

            Assert.That(log.Writer.ToString(), Is.StringContaining("Pouf"));
            Assert.That(log.Writer.ToString(), Is.StringContaining("Failed!"), "Explicit conclusion wins.");
            Assert.That(log.Writer.ToString(), Is.Not.StringContaining("Success!"), "Explicit conclusion wins.");
        }
Example #2
0
        public void MultipleClose()
        {
            IDefaultActivityLogger logger = DefaultActivityLogger.Create();

            // Binds the TestHelper.Logger logger to this one.
            logger.Output.RegisterMuxClient(TestHelper.Logger.Output.ExternalInput);

            var log1 = new StringImpl();

            logger.Register(log1);

            Assert.That(logger.RegisteredSinks.Count, Is.EqualTo(1));

            using (logger.OpenGroup(LogLevel.Trace, () => "End First", "First"))
            {
                logger.CloseGroup("Pouf");
                using (logger.OpenGroup(LogLevel.Warn, "A group at level 0!"))
                {
                    logger.CloseGroup("Close it.");
                    logger.CloseGroup("Close it again.");
                }
            }

            Assert.That(log1.Writer.ToString(), Is.Not.StringContaining("End First"), "Close forgets other closes...");
            Assert.That(log1.Writer.ToString(), Is.Not.StringContaining("Close it again"), "Close forgets other closes...");
        }
Example #3
0
        public void CatchTests()
        {
            IDefaultActivityLogger d = DefaultActivityLogger.Create();

            Assert.Throws <ArgumentNullException>(() => d.Catch(null));

            d.Error("Pouf");
            using (d.Catch(e => Assert.That(String.Join(",", e.Select(t => t.Text)) == "One,Two")))
            {
                d.Error("One");
                d.Warn("Warn");
                d.Fatal("Two");
            }
            d.Error("Out...");
            using (d.Catch(e => e.Single(t => t.Text == "Two"), LogLevelFilter.Fatal))
            {
                d.Error("One");
                d.Warn("Warn");
                d.Fatal("Two");
            }

            using (d.Catch(e => Assert.Fail("No Error occured.")))
            {
                d.Trace("One");
                d.Warn("Warn");
            }

            using (d.Catch(e => Assert.Fail("No Fatal occured."), LogLevelFilter.Fatal))
            {
                d.Error("One");
                d.Warn("Warn");
            }
        }
Example #4
0
        public void FilterLevel()
        {
            IDefaultActivityLogger l = DefaultActivityLogger.Create();

            // Binds the TestHelper.Logger logger to this one.
            l.Output.RegisterMuxClient(TestHelper.Logger.Output.ExternalInput);

            var log = new StringImpl();

            l.Register(log);
            using (l.Filter(LogLevelFilter.Error))
            {
                l.Trace("NO SHOW");
                l.Info("NO SHOW");
                l.Warn("NO SHOW");
                l.Error("Error n°1");
                using (l.Filter(LogLevelFilter.Warn))
                {
                    l.Trace("NO SHOW");
                    l.Info("NO SHOW");
                    l.Warn("Warn n°1");
                    l.Error("Error n°2");
                    using (l.OpenGroup(LogLevel.Info, "GroupInfo"))
                    {
                        Assert.That(l.Filter, Is.EqualTo(LogLevelFilter.Warn), "Groups does not change the current filter level.");
                        l.Trace("NO SHOW");
                        l.Info("NO SHOW");
                        l.Warn("Warn n°2");
                        l.Error("Error n°3");
                        // Changing the level inside a Group.
                        l.Filter = LogLevelFilter.Fatal;
                        l.Error("NO SHOW");
                        l.Fatal("Fatal n°1");
                    }
                    Assert.That(l.Filter, Is.EqualTo(LogLevelFilter.Warn), "But Groups restores the original filter level when closed.");
                    l.Trace("NO SHOW");
                    l.Info("NO SHOW");
                    l.Warn("Warn n°3");
                    l.Error("Error n°4");
                    l.Fatal("Fatal n°2");
                }
                l.Trace("NO SHOW");
                l.Info("NO SHOW");
                l.Warn("NO SHOW");
                l.Error("Error n°5");
            }
            Assert.That(log.Writer.ToString(), Is.Not.StringContaining("NO SHOW"));
            Assert.That(log.Writer.ToString(), Is.StringContaining("Error n°1")
                        .And.StringContaining("Error n°2")
                        .And.StringContaining("Error n°3")
                        .And.StringContaining("Error n°4")
                        .And.StringContaining("Error n°5"));
            Assert.That(log.Writer.ToString(), Is.StringContaining("Warn n°1")
                        .And.StringContaining("Warn n°2")
                        .And.StringContaining("Warn n°3"));
            Assert.That(log.Writer.ToString(), Is.StringContaining("Fatal n°1")
                        .And.StringContaining("Fatal n°2"));
        }
Example #5
0
        public void DefaultActivityLoggerDefaults()
        {
            IDefaultActivityLogger l = DefaultActivityLogger.Create();

            Assert.Throws <InvalidOperationException>(() => l.Output.UnregisterClient(l.Tap));
            Assert.Throws <InvalidOperationException>(() => l.Output.UnregisterMuxClient(l.Tap));
            Assert.Throws <InvalidOperationException>(() => l.Output.UnregisterClient(l.PathCatcher));
            Assert.Throws <InvalidOperationException>(() => l.Output.UnregisterMuxClient(l.PathCatcher));
            Assert.Throws <InvalidOperationException>(() => l.Output.UnregisterClient(l.ErrorCounter));
            Assert.Throws <InvalidOperationException>(() => l.Output.UnregisterMuxClient(l.ErrorCounter));
        }
Example #6
0
        public void DefaultImpl()
        {
            IDefaultActivityLogger logger = DefaultActivityLogger.Create();

            // Binds the TestHelper.Logger logger to this one.
            logger.Output.RegisterMuxClient(TestHelper.Logger.Output.ExternalInput);

            logger.Register(new StringImpl()).Register(new XmlImpl(new StringWriter()));

            Assert.That(logger.RegisteredSinks.Count, Is.EqualTo(2));

            using (logger.OpenGroup(LogLevel.Trace, () => "EndMainGroup", "MainGroup"))
            {
                logger.Trace("First");
                logger.Trace("Second");
                logger.Trace("Third");
                logger.Info("First");

                using (logger.OpenGroup(LogLevel.Info, () => "EndInfoGroup", "InfoGroup"))
                {
                    logger.Info("Second");
                    logger.Trace("Fourth");

                    using (logger.OpenGroup(LogLevel.Warn, () => "EndWarnGroup", "WarnGroup {0} - Now = {1}", 4, DateTime.UtcNow))
                    {
                        logger.Info("Warn!");
                    }
                }
            }

            Console.WriteLine(logger.RegisteredSinks.OfType <StringImpl>().Single().Writer);
            Console.WriteLine(logger.RegisteredSinks.OfType <XmlImpl>().Single().InnerWriter);

            XPathDocument d = new XPathDocument(new StringReader(logger.RegisteredSinks.OfType <XmlImpl>().Single().InnerWriter.ToString()));

            Assert.That(d.CreateNavigator().SelectDescendants("Info", String.Empty, false), Is.Not.Empty.And.Count.EqualTo(3));
            Assert.That(d.CreateNavigator().SelectDescendants("Trace", String.Empty, false), Is.Not.Empty.And.Count.EqualTo(2));
        }
Example #7
0
        public void CloseMismatch()
        {
            IDefaultActivityLogger l = DefaultActivityLogger.Create();
            var log = new StringImpl();

            l.Register(log);
            {
                IDisposable g0 = l.OpenGroup(LogLevel.Trace, "First");
                IDisposable g1 = l.OpenGroup(LogLevel.Trace, "Second");
                IDisposable g2 = l.OpenGroup(LogLevel.Trace, "Third");

                g1.Dispose();
                l.Trace("Inside First");
                g0.Dispose();
                l.Trace("At root");

                var end = "Trace: Inside First" + Environment.NewLine + "-" + Environment.NewLine + "Trace: At root";
                Assert.That(log.Writer.ToString(), Is.StringEnding(end));
            }
            {
                // g2 is closed after g1.
                IDisposable g0 = l.OpenGroup(LogLevel.Trace, "First");
                IDisposable g1 = l.OpenGroup(LogLevel.Trace, "Second");
                IDisposable g2 = l.OpenGroup(LogLevel.Trace, "Third");
                log.Writer.GetStringBuilder().Clear();
                g1.Dispose();
                // g2 has already been disposed by g1.
                // Nothing changed.
                g2.Dispose();
                l.Trace("Inside First");
                g0.Dispose();
                l.Trace("At root");

                var end = "Trace: Inside First" + Environment.NewLine + "-" + Environment.NewLine + "Trace: At root";
                Assert.That(log.Writer.ToString(), Is.StringEnding(end));
            }
        }
Example #8
0
        public void SimpleCollectorTest()
        {
            IDefaultActivityLogger d = DefaultActivityLogger.Create();
            var c = new ActivityLoggerSimpleCollector();

            d.Output.RegisterClient(c);
            d.Warn("1");
            d.Error("2");
            d.Fatal("3");
            d.Trace("4");
            d.Info("5");
            d.Warn("6");
            Assert.That(String.Join(",", c.Entries.Select(e => e.Text)), Is.EqualTo("2,3"));

            c.LevelFilter = LogLevelFilter.Fatal;
            Assert.That(String.Join(",", c.Entries.Select(e => e.Text)), Is.EqualTo("3"));

            c.LevelFilter = LogLevelFilter.Off;
            Assert.That(String.Join(",", c.Entries.Select(e => e.Text)), Is.EqualTo(""));

            c.LevelFilter = LogLevelFilter.Warn;
            using (d.OpenGroup(LogLevel.Warn, "1"))
            {
                d.Error("2");
                using (d.OpenGroup(LogLevel.Fatal, "3"))
                {
                    d.Trace("4");
                    d.Info("5");
                }
            }
            d.Warn("6");
            Assert.That(String.Join(",", c.Entries.Select(e => e.Text)), Is.EqualTo("1,2,3,6"));

            c.LevelFilter = LogLevelFilter.Fatal;
            Assert.That(String.Join(",", c.Entries.Select(e => e.Text)), Is.EqualTo("3"));
        }
Example #9
0
        public void PathCatcherTests()
        {
            var logger = DefaultActivityLogger.Create();

            // Binds the TestHelper.Logger logger to this one.
            logger.Output.RegisterMuxClient(TestHelper.Logger.Output.ExternalInput);

            ActivityLoggerPathCatcher p = new ActivityLoggerPathCatcher();

            logger.Output.RegisterMuxClient(p);

            logger.Trace("Trace n°1");
            Assert.That(p.DynamicPath.Select(e => e.Level.ToString() + '|' + e.Text).Single(), Is.EqualTo("Trace|Trace n°1"));
            Assert.That(p.LastErrorPath, Is.Null);
            Assert.That(p.LastWarnOrErrorPath, Is.Null);

            logger.Trace("Trace n°2");
            Assert.That(p.DynamicPath.Select(e => e.Level.ToString() + '|' + e.Text).Single(), Is.EqualTo("Trace|Trace n°2"));
            Assert.That(p.LastErrorPath, Is.Null);
            Assert.That(p.LastWarnOrErrorPath, Is.Null);

            logger.Warn("W1");
            Assert.That(p.DynamicPath.Select(e => e.Level.ToString() + '|' + e.Text).Single(), Is.EqualTo("Warn|W1"));
            Assert.That(p.LastErrorPath, Is.Null);
            Assert.That(p.LastWarnOrErrorPath.Select(e => e.Level.ToString() + '|' + e.Text).Single(), Is.EqualTo("Warn|W1"));

            logger.Error("E2");
            logger.Warn("W1bis");
            Assert.That(p.DynamicPath.Select(e => e.Level.ToString() + '|' + e.Text).Single(), Is.EqualTo("Warn|W1bis"));
            Assert.That(p.LastErrorPath.Select(e => e.Level.ToString() + '|' + e.Text).Single(), Is.EqualTo("Error|E2"));
            Assert.That(p.LastWarnOrErrorPath.Select(e => e.Level.ToString() + '|' + e.Text).Single(), Is.EqualTo("Warn|W1bis"));

            p.ClearLastWarnPath();
            Assert.That(p.LastErrorPath, Is.Not.Null);
            Assert.That(p.LastWarnOrErrorPath, Is.Null);

            p.ClearLastErrorPath();
            Assert.That(p.LastErrorPath, Is.Null);

            using (logger.OpenGroup(LogLevel.Trace, "G1"))
            {
                using (logger.OpenGroup(LogLevel.Info, "G2"))
                {
                    Assert.That(String.Join(">", p.DynamicPath.Select(e => e.Text)), Is.EqualTo("G1>G2"));
                    Assert.That(p.LastErrorPath, Is.Null);
                    using (logger.OpenGroup(LogLevel.Trace, "G3"))
                    {
                        using (logger.OpenGroup(LogLevel.Info, "G4"))
                        {
                            logger.Warn("W1");

                            Assert.That(String.Join(">", p.DynamicPath.Select(e => e.Text)), Is.EqualTo("G1>G2>G3>G4>W1"));

                            logger.Info(
                                new Exception("An exception logged as an Info.",
                                              new Exception("With an inner exception. Since these exceptions have not been thrown, there is no stack trace.")),
                                "Test With an exception: a Group is created. Since the text of the log is given, the Exception.Message must be displayed explicitely.");

                            Assert.That(String.Join(">", p.DynamicPath.Select(e => e.Text)), Is.EqualTo("G1>G2>G3>G4>Test With an exception: a Group is created. Since the text of the log is given, the Exception.Message must be displayed explicitely."));

                            try
                            {
                                try
                                {
                                    try
                                    {
                                        try
                                        {
                                            throw new Exception("Deepest excpetion.");
                                        }
                                        catch (Exception ex)
                                        {
                                            throw new Exception("Yet another inner with inner Exception.", ex);
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        throw new Exception("Exception with inner Exception.", ex);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    throw new Exception("Log without log text: the text of the entry is the Exception.Message.", ex);
                                }
                            }
                            catch (Exception ex)
                            {
                                logger.Trace(ex);
                            }

                            Assert.That(p.LastErrorPath, Is.Null);
                            Assert.That(String.Join(">", p.LastWarnOrErrorPath.Select(e => e.Level.ToString() + '|' + e.Text)), Is.EqualTo("Trace|G1>Info|G2>Trace|G3>Info|G4>Warn|W1"));
                        }
                        Assert.That(String.Join(">", p.DynamicPath.Select(e => e.Text)), Is.EqualTo("G1>G2>G3>G4"));
                        Assert.That(p.LastErrorPath, Is.Null);
                        Assert.That(String.Join(">", p.LastWarnOrErrorPath.Select(e => e.Level.ToString() + '|' + e.Text)), Is.EqualTo("Trace|G1>Info|G2>Trace|G3>Info|G4>Warn|W1"));

                        logger.Error("E1");
                        Assert.That(String.Join(">", p.DynamicPath.Select(e => e.Text)), Is.EqualTo("G1>G2>G3>E1"));
                        Assert.That(String.Join(">", p.LastErrorPath.Select(e => e.Level.ToString() + '|' + e.Text)), Is.EqualTo("Trace|G1>Info|G2>Trace|G3>Error|E1"));
                        Assert.That(String.Join(">", p.LastWarnOrErrorPath.Select(e => e.Level.ToString() + '|' + e.Text)), Is.EqualTo("Trace|G1>Info|G2>Trace|G3>Error|E1"));
                    }
                    Assert.That(String.Join(">", p.DynamicPath.Select(e => e.Text)), Is.EqualTo("G1>G2>G3"));
                    Assert.That(String.Join(">", p.LastErrorPath.Select(e => e.Level.ToString() + '|' + e.Text)), Is.EqualTo("Trace|G1>Info|G2>Trace|G3>Error|E1"));
                    Assert.That(String.Join(">", p.LastWarnOrErrorPath.Select(e => e.Level.ToString() + '|' + e.Text)), Is.EqualTo("Trace|G1>Info|G2>Trace|G3>Error|E1"));
                }
                Assert.That(String.Join(">", p.DynamicPath.Select(e => e.Text)), Is.EqualTo("G1>G2"));
                using (logger.OpenGroup(LogLevel.Trace, "G2Bis"))
                {
                    Assert.That(String.Join(">", p.DynamicPath.Select(e => e.Text)), Is.EqualTo("G1>G2Bis"));
                    Assert.That(String.Join(">", p.LastErrorPath.Select(e => e.Level.ToString() + '|' + e.Text)), Is.EqualTo("Trace|G1>Info|G2>Trace|G3>Error|E1"));
                    Assert.That(String.Join(">", p.LastWarnOrErrorPath.Select(e => e.Level.ToString() + '|' + e.Text)), Is.EqualTo("Trace|G1>Info|G2>Trace|G3>Error|E1"));

                    logger.Warn("W2");
                    Assert.That(String.Join(">", p.DynamicPath.Select(e => e.Text)), Is.EqualTo("G1>G2Bis>W2"));
                    Assert.That(String.Join(">", p.LastWarnOrErrorPath.Select(e => e.Level.ToString() + '|' + e.Text)), Is.EqualTo("Trace|G1>Trace|G2Bis>Warn|W2"));
                    Assert.That(String.Join(">", p.LastErrorPath.Select(e => e.Level.ToString() + '|' + e.Text)), Is.EqualTo("Trace|G1>Info|G2>Trace|G3>Error|E1"));
                }
                logger.Fatal("F1");
                Assert.That(String.Join(">", p.DynamicPath.Select(e => e.Text)), Is.EqualTo("G1>F1"));
                Assert.That(String.Join(">", p.LastWarnOrErrorPath.Select(e => e.Level.ToString() + '|' + e.Text)), Is.EqualTo("Trace|G1>Fatal|F1"));
                Assert.That(String.Join(">", p.LastErrorPath.Select(e => e.Level.ToString() + '|' + e.Text)), Is.EqualTo("Trace|G1>Fatal|F1"));
            }

            // Extraneous closing are ignored.
            logger.CloseGroup(null);

            logger.Warn("W3");
            Assert.That(String.Join(">", p.DynamicPath.Select(e => e.Text)), Is.EqualTo("W3"));
            Assert.That(String.Join(">", p.LastWarnOrErrorPath.Select(e => e.Level.ToString() + '|' + e.Text)), Is.EqualTo("Warn|W3"));
            Assert.That(String.Join(">", p.LastErrorPath.Select(e => e.Level.ToString() + '|' + e.Text)), Is.EqualTo("Trace|G1>Fatal|F1"));

            // Extraneous closing are ignored.
            logger.CloseGroup(null);

            logger.Warn("W4");
            Assert.That(String.Join(">", p.DynamicPath.Select(e => e.Text)), Is.EqualTo("W4"));
            Assert.That(String.Join(">", p.LastWarnOrErrorPath.Select(e => e.Level.ToString() + '|' + e.Text)), Is.EqualTo("Warn|W4"));
            Assert.That(String.Join(">", p.LastErrorPath.Select(e => e.Level.ToString() + '|' + e.Text)), Is.EqualTo("Trace|G1>Fatal|F1"));

            p.ClearLastWarnPath(true);
            Assert.That(p.LastErrorPath, Is.Null);
            Assert.That(p.LastWarnOrErrorPath, Is.Null);
        }
Example #10
0
 static TestHelper()
 {
     _console = new ActivityLoggerConsoleSink();
     _logger  = DefaultActivityLogger.Create().Register(_console);
 }
Example #11
0
        public void Overloads()
        {
            Exception ex = new Exception("EXCEPTION");
            string    fmt0 = "fmt", fmt1 = "fmt{0}", fmt2 = "fmt{0}{1}", fmt3 = "fmt{0}{1}{2}", fmt4 = "fmt{0}{1}{2}{3}", fmt5 = "fmt{0}{1}{2}{3}{4}", fmt6 = "fmt{0}{1}{2}{3}{4}{5}";
            string    p1 = "p1", p2 = "p2", p3 = "p3", p4 = "p4", p5 = "p5", p6 = "p6";

            IDefaultActivityLogger d = DefaultActivityLogger.Create();
            var collector            = new ActivityLoggerSimpleCollector()
            {
                LevelFilter = LogLevelFilter.Trace, Capacity = 1
            };

            d.Output.RegisterClient(collector);

            d.Trace(fmt0); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmt"));
            d.Trace(fmt1, p1); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1"));
            d.Trace(fmt2, p1, p2); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2"));
            d.Trace(fmt3, p1, p2, p3); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3"));
            d.Trace(fmt4, p1, p2, p3, p4); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4"));
            d.Trace(fmt5, p1, p2, p3, p4, p5); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5"));
            d.Trace(fmt6, p1, p2, p3, p4, p5, p6); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5p6"));

            d.Info(fmt0); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmt"));
            d.Info(fmt1, p1); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1"));
            d.Info(fmt2, p1, p2); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2"));
            d.Info(fmt3, p1, p2, p3); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3"));
            d.Info(fmt4, p1, p2, p3, p4); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4"));
            d.Info(fmt5, p1, p2, p3, p4, p5); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5"));
            d.Info(fmt6, p1, p2, p3, p4, p5, p6); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5p6"));

            d.Warn(fmt0); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmt"));
            d.Warn(fmt1, p1); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1"));
            d.Warn(fmt2, p1, p2); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2"));
            d.Warn(fmt3, p1, p2, p3); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3"));
            d.Warn(fmt4, p1, p2, p3, p4); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4"));
            d.Warn(fmt5, p1, p2, p3, p4, p5); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5"));
            d.Warn(fmt6, p1, p2, p3, p4, p5, p6); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5p6"));

            d.Error(fmt0); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmt"));
            d.Error(fmt1, p1); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1"));
            d.Error(fmt2, p1, p2); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2"));
            d.Error(fmt3, p1, p2, p3); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3"));
            d.Error(fmt4, p1, p2, p3, p4); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4"));
            d.Error(fmt5, p1, p2, p3, p4, p5); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5"));
            d.Error(fmt6, p1, p2, p3, p4, p5, p6); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5p6"));

            d.Fatal(fmt0); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmt"));
            d.Fatal(fmt1, p1); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1"));
            d.Fatal(fmt2, p1, p2); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2"));
            d.Fatal(fmt3, p1, p2, p3); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3"));
            d.Fatal(fmt4, p1, p2, p3, p4); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4"));
            d.Fatal(fmt5, p1, p2, p3, p4, p5); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5"));
            d.Fatal(fmt6, p1, p2, p3, p4, p5, p6); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5p6"));

            d.OpenGroup(LogLevel.Trace, fmt0); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmt"));
            d.OpenGroup(LogLevel.Trace, fmt1, p1); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1"));
            d.OpenGroup(LogLevel.Trace, fmt2, p1, p2); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2"));
            d.OpenGroup(LogLevel.Trace, fmt3, p1, p2, p3); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3"));
            d.OpenGroup(LogLevel.Trace, fmt4, p1, p2, p3, p4); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4"));
            d.OpenGroup(LogLevel.Trace, fmt5, p1, p2, p3, p4, p5); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5"));
            d.OpenGroup(LogLevel.Trace, fmt6, p1, p2, p3, p4, p5, p6); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5p6"));

            d.Trace(ex); Assert.That(collector.Entries.Last().Text, Is.EqualTo("EXCEPTION")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Trace(ex, fmt0); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmt")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Trace(ex, fmt1, p1); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Trace(ex, fmt2, p1, p2); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Trace(ex, fmt3, p1, p2, p3); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Trace(ex, fmt4, p1, p2, p3, p4); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Trace(ex, fmt5, p1, p2, p3, p4, p5); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Trace(ex, fmt6, p1, p2, p3, p4, p5, p6); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5p6")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));

            d.Info(ex); Assert.That(collector.Entries.Last().Text, Is.EqualTo("EXCEPTION")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Info(ex, fmt0); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmt")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Info(ex, fmt1, p1); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Info(ex, fmt2, p1, p2); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Info(ex, fmt3, p1, p2, p3); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Info(ex, fmt4, p1, p2, p3, p4); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Info(ex, fmt5, p1, p2, p3, p4, p5); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Info(ex, fmt6, p1, p2, p3, p4, p5, p6); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5p6")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));

            d.Warn(ex); Assert.That(collector.Entries.Last().Text, Is.EqualTo("EXCEPTION")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Warn(ex, fmt0); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmt")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Warn(ex, fmt1, p1); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Warn(ex, fmt2, p1, p2); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Warn(ex, fmt3, p1, p2, p3); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Warn(ex, fmt4, p1, p2, p3, p4); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Warn(ex, fmt5, p1, p2, p3, p4, p5); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Warn(ex, fmt6, p1, p2, p3, p4, p5, p6); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5p6")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));

            d.Error(ex); Assert.That(collector.Entries.Last().Text, Is.EqualTo("EXCEPTION")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Error(ex, fmt0); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmt")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Error(ex, fmt1, p1); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Error(ex, fmt2, p1, p2); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Error(ex, fmt3, p1, p2, p3); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Error(ex, fmt4, p1, p2, p3, p4); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Error(ex, fmt5, p1, p2, p3, p4, p5); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Error(ex, fmt6, p1, p2, p3, p4, p5, p6); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5p6")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));

            d.Fatal(ex); Assert.That(collector.Entries.Last().Text, Is.EqualTo("EXCEPTION")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Fatal(ex, fmt0); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmt")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Fatal(ex, fmt1, p1); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Fatal(ex, fmt2, p1, p2); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Fatal(ex, fmt3, p1, p2, p3); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Fatal(ex, fmt4, p1, p2, p3, p4); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Fatal(ex, fmt5, p1, p2, p3, p4, p5); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.Fatal(ex, fmt6, p1, p2, p3, p4, p5, p6); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5p6")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));

            d.OpenGroup(LogLevel.Trace, ex); Assert.That(collector.Entries.Last().Text, Is.EqualTo("EXCEPTION")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.OpenGroup(LogLevel.Trace, ex, fmt0); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmt")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.OpenGroup(LogLevel.Trace, ex, fmt1, p1); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.OpenGroup(LogLevel.Trace, ex, fmt2, p1, p2); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.OpenGroup(LogLevel.Trace, ex, fmt3, p1, p2, p3); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.OpenGroup(LogLevel.Trace, ex, fmt4, p1, p2, p3, p4); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.OpenGroup(LogLevel.Trace, ex, fmt5, p1, p2, p3, p4, p5); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
            d.OpenGroup(LogLevel.Trace, ex, fmt6, p1, p2, p3, p4, p5, p6); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5p6")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex));
        }