Beispiel #1
0
        public void TestGetLoggerByType()
        {
            var manager = new LogManager(new LoggingConfiguration());

            var logger = manager.GetLogger<LogManagerBaseTests>();
            Assert.NotNull(logger);
        }
Beispiel #2
0
        public void TestGetLogger()
        {
            var manager = new LogManager(new LoggingConfiguration());

            var logger = manager.GetLogger("Foobar");
            Assert.NotNull(logger);
        }
Beispiel #3
0
        public void TestLoggerCreated()
        {
            bool called = false;
            var manager = new LogManager(new LoggingConfiguration());
            manager.LoggerCreated += (sender, args) =>
            {
                called = true;
            };

            // call...
            var logger = manager.GetLogger<LogManagerBaseTests>();
            
            // check...
            Assert.True(called);
        }
Beispiel #4
0
        public async Task TestGetZipNetFile()
        {

            var manager = new LogManager(LogManagerFactory.CreateLibraryDefaultSettings());
            manager.DefaultConfiguration.AddTarget(LogLevel.Trace, LogLevel.Fatal, new StreamingFileTarget());

            var logger = (ILoggerAsync)manager.GetLogger("test");
            // send through a log entry...
            await logger.DebugAsync("Test Message");

            var str = await manager.GetCompressedLogs();

            var file =
              new FileInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory, Environment.SpecialFolderOption.None), "logs.zip"));



            using (var stream = file.Create())
            {
                await str.CopyToAsync(stream);
            }
        }
 public HttpClient()
 {
     LogManager lm = new LogManager();
     Logger = lm.GetLogger<HttpClient>();
 }
Beispiel #6
0
        public void TestIsFatalEnabled()
        {
            var target = new LogManager(new LoggingConfiguration());

            // get a logger...
            var logger = target.GetLogger("foo");

            // check...
            Assert.False(logger.IsTraceEnabled);
            Assert.False(logger.IsDebugEnabled);
            Assert.False(logger.IsInfoEnabled);
            Assert.False(logger.IsErrorEnabled);
            Assert.False(logger.IsErrorEnabled);
            Assert.False(logger.IsFatalEnabled);
        }