Ejemplo n.º 1
0
        private void InitializeStatics(IContainerRegistry containerRegistry)
        {
            NLogLoggerFactory fac = new NLogLoggerFactory();

            Log.Initialize(containerRegistry.GetContainer().Resolve <DialogService>(), fac.CreateLogger("ErrorLog"), fac.CreateLogger("InfoLog"));
            fac.Dispose();

            SourceCodeLocator.Initialize(globalCache);
        }
Ejemplo n.º 2
0
        public void Dispose_HappyPath_FlushLogFactory()
        {
            // Arrange
            ConfigureLoggerProvider();
            ConfigureNLog(new Targets.Wrappers.BufferingTargetWrapper("buffer", new Targets.MemoryTarget("output")));
            var loggerFactory = new NLogLoggerFactory(LoggerProvider);

            // Act
            loggerFactory.CreateLogger("test").LogInformation("Hello");
            loggerFactory.Dispose();

            // Assert
            Assert.Single(LoggerProvider.LogFactory.Configuration.FindTargetByName <Targets.MemoryTarget>("output").Logs);
        }
Ejemplo n.º 3
0
        public void Dispose_HappyPath_FlushLogFactory()
        {
            // Arrange
            var loggerFactory = new NLogLoggerFactory();

            var internalLogWriter = CaptureInternalLog();

            // Act
            loggerFactory.Dispose();

            // Assert
            var internalLog = internalLogWriter.ToString();

            Assert.Contains("LogFactory.Flush", internalLog, StringComparison.OrdinalIgnoreCase);
        }