예제 #1
0
        public void WriteToNamed()
        {
            var myloggy = Loggy.Get("named");

            myloggy.Info("test");
            appender.MustCatch(LogLevel.Info, "test", "named");
        }
예제 #2
0
 public void Setup()
 {
     Loggy.Manager = null;
     Loggy.Manager = new LoggyManager();
     this.appender = new TestAppender {
         Level = LogLevel.Info
     };
     Loggy.Get().Appenders.Add(appender);
     Loggy.Level = LogLevel.Trace;
 }
예제 #3
0
        public void ValidConfig()
        {
            var def = Loggy.Get();

            Assert.NotNull(def);
            Assert.True(def.Isolated);
            Assert.AreEqual(1, def.Appenders.Count);
            Assert.AreEqual(appender, def.Appenders[0]);
            Assert.AreEqual("default", def.Name);
        }
예제 #4
0
        public void CanResetLogger()
        {
            var logger = Loggy.Get("named");

            Assert.False(logger.Isolated);
            Loggy.Manager.Loggers["named"] = new DefaultLoggy {
                Name = "xxxx"
            };
            var logger2 = Loggy.Get("named");

            Assert.AreEqual("xxxx", logger2.Name);
        }
예제 #5
0
        public void WriteToSpecial()
        {
            var myappender = new TestAppender {
                Level = LogLevel.Debug
            };

            Loggy.Get("named", s => {
                s.Isolated = true;
                s.Level    = LogLevel.Info;
                s.Appenders.Add(myappender);
            });
            Loggy.Get("named").Info("test");
            appender.MustNotCatch(LogLevel.Info, "test", "named");
            myappender.MustCatch(LogLevel.Info, "test", "named");
        }
예제 #6
0
 private void CreateLogger()
 {
     if (LoggerHost != "" && LoggerPort != 0 && LoggerName != "")
     {
         Console.WriteLine("LOGLEVEL " + LogLevel);
         var def = Loggy.Get();
         def.Level = LogLevel;
         def.Appenders.Add(new UdpAppender(LoggerHost, LoggerPort)
         {
             AutoFlushSize = 1, Format = LoggerFormat
         });
         def.Debug("debug test тест");
         def.Trace("trace test тест");
         def.Info("info test тест");
         def.Warn("warning test тест");
         def.Error("error test тест", new Exception("Test exception"));
         def.Fatal("fatal test тест");
     }
 }
예제 #7
0
 public TrustedOrigin()
 {
     this.logg = Loggy.Get("sys.sec.trusted");
 }