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); }
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); }
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); }