public void Should_not_cache_settings_when_there_are_no_errors()
        {
            var settings  = new FileLogSettings();
            var settings2 = new FileLogSettings();
            var provider  = new SafeSettingsProvider(() => settings);

            provider.Get().Should().BeSameAs(settings);

            settings = settings2;
            provider.Get().Should().BeSameAs(settings2);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
 /// <summary>
 /// Create a new Hercules log with the dynamic settings provided by given delegate.
 /// </summary>
 public HerculesLog(Func <HerculesLogSettings> settingsProvider)
 {
     this.settingsProvider = new SafeSettingsProvider(settingsProvider);
     this.settingsProvider.Get();
 }