コード例 #1
0
        public void Test2()
        {
            var logger = new Logger("scope");
            var output = new SyntheticOutput();
            var list   = new List <string> {
                "first", "second"
            };

            logger.Outputs.Clear();
            logger.Outputs.Add(output);

            logger.Log("info", list);

            Assert.Equal($"{ "[scope]".Pastel(logger.Colors[0]) } {"[i]".Pastel(Color.Cyan)} { Ansi.Underline("Info").Pastel(Color.Cyan) + "      " } { "first".Pastel(logger.Colors[1]) }", output.Lines[0]);
            Assert.Equal($"{ "[scope]".Pastel(logger.Colors[0]) }              { "  second".Pastel(logger.Colors[1]) }", output.Lines[1]);
        }
コード例 #2
0
        public void TestFormatterWithScope()
        {
            var logger     = new Logger("scope");
            var output     = new SyntheticOutput();
            var dictionary = new Dictionary <string, string> {
                { "1", "first" }, { "2", "second" }
            };

            logger.Outputs.Clear();
            logger.Outputs.Add(output);

            logger.Log("info", dictionary);

            Assert.Equal($"{ "[scope]".Pastel(logger.Colors[0]) } {"[i]".Pastel(Color.Cyan)} { Ansi.Underline("Info").Pastel(Color.Cyan) + "      " } { "1 = first".Pastel(logger.Colors[1]) }", output.Lines[0]);
            Assert.Equal($"{ "[scope]".Pastel(logger.Colors[0]) }              { "  2 = second".Pastel(logger.Colors[1]) }", output.Lines[1]);
        }