public void TearDown() { log.Dispose(); registration.Dispose(); log = null; registration = null; muxer = null; }
internal FileLog(IMultiFileMuxer muxer, Func <FileLogSettings> settingsProvider) { this.settingsProvider = new SafeSettingsProvider(settingsProvider); this.settingsProvider.Get(); this.muxer = muxer; muxerHandle = new object(); muxerHandleRef = new WeakReference(muxerHandle); muxerRegistrationLock = new object(); eventsLost = new AtomicLong(0); filePathProvider = new CachingTransform <FileLogSettings, FilePath>( settings => new FilePath(settings.FilePath), preventParallelProcessing: false); }
public void TestSetup() { capturedEvents = new List <LogEvent>(); registration = Substitute.For <IMuxerRegistration>(); registration.IsValid("logs/log").Returns(true); muxer = Substitute.For <IMultiFileMuxer>(); muxer.TryAdd(Arg.Any <FilePath>(), Arg.Do <LogEventInfo>(e => capturedEvents.Add(e.Event)), Arg.Any <WeakReference>()).Returns(true); muxer.Register(Arg.Any <FilePath>(), Arg.Any <FileLogSettings>(), Arg.Any <WeakReference>()).Returns(registration); settings = new FileLogSettings { FilePath = "logs/log", OutputTemplate = OutputTemplate.Parse("{Message}"), EnableFileLogSettingsCache = false }; log = new FileLog(muxer, () => settings); }