ShutDown() 공개 메소드

public ShutDown ( ) : void
리턴 void
예제 #1
0
        static void InitBody()
        {
            if (options == null)
            {
                options = new Options("", "Log");
            }
            LogDefaultOptions.AddDefaultOptions(options);
            LogLevel.SetLevel(LogLevel.Always, options[LogDefaultOptions.AlwaysOption]);
            LogLevel.SetLevel(LogLevel.Fatal, options[LogDefaultOptions.FatalOption]);
            LogLevel.SetLevel(LogLevel.Error, options[LogDefaultOptions.ErrorOption]);
            LogLevel.SetLevel(LogLevel.Warning, options[LogDefaultOptions.WarningOption]);
            LogLevel.SetLevel(LogLevel.Info, options[LogDefaultOptions.InfoOption]);
            LogLevel.SetLevel(LogLevel.Event, options[LogDefaultOptions.EventOption]);
            LogLevel.SetLevel(LogLevel.Debug, options[LogDefaultOptions.DebugOption]);
            LogLevel.SetLevel(LogLevel.All, options[LogDefaultOptions.AllOption]);
            LogLevel.SetDefault(options["LogLevel"]);

            if (collector != null)
            {
                collector.ShutDown();
            }
            collector = new LogCollector(new ConcurrentQueued <LogItem>(new PoolThreadStarter()),
                                         new LogWriterFactory(options).GetWriter());

            if (container == null)
            {
                container = new LoggerContainer(category => new CheckingLogger(category, collector.Send, LogLevel.Default));
            }
            else
            {
                container.SetSender(collector.Send);
            }
            container.DefaultCategory = options.Get("LogDefaultCategory", "Default");
            init = true;
        }
예제 #2
0
        public void ShutDownTest()
        {
            LogItem message = new LogItem(category, level, msg, ids, GetException());
             var qThread = new Mock<IQueued<LogItem>>(MockBehavior.Strict);
             var writer = new Mock<ILogWriter>(MockBehavior.Strict);

             qThread
            .Setup(s => s.Terminate());
             writer
            .Setup(s => s.GetTimeout())
            .Returns(timeout);
             qThread
            .Setup(s => s.SetTimeout(It.IsAny<int>()));

             LogCollector target = new LogCollector(qThread.Object, writer.Object);
             target.ShutDown();

             qThread
            .Verify(s => s.Terminate(), Times.Once());
        }