private static ConsoleLogMuxer CreateMuxer(ConsoleLogGlobalSettings settings)
        {
            var consoleFeaturesDetector = new ConsoleFeaturesDetector();
            var consoleWriterFactory    = new ConsoleWriterFactory(consoleFeaturesDetector, settings.OutputBufferSize);
            var consoleWriter           = consoleWriterFactory.CreateWriter();
            var eventsBatcher           = new EventsBatcher(consoleFeaturesDetector);
            var eventsWriter            = new EventsWriter(eventsBatcher, consoleWriter, consoleFeaturesDetector);

            return(new ConsoleLogMuxer(eventsWriter, settings.EventsQueueCapacity, settings.EventsTemporaryBufferCapacity));
        }
Beispiel #2
0
        public static ConsoleLogGlobalSettings ValidateGlobalSettings(ConsoleLogGlobalSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            if (settings.EventsQueueCapacity <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(settings.EventsQueueCapacity), $"{nameof(settings.EventsQueueCapacity)} must be positive");
            }

            if (settings.EventsTemporaryBufferCapacity <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(settings.EventsQueueCapacity), $"{nameof(settings.EventsTemporaryBufferCapacity)} must be positive");
            }

            return(settings);
        }
 public void UpdateSettings(ConsoleLogGlobalSettings newSettings)
 {
     muxerSettings = SettingsValidator.ValidateGlobalSettings(newSettings);
 }
Beispiel #4
0
 /// <summary>
 /// <para>Update settings that affect all console log instances.</para>
 /// <para>This method only works when called before the first event was logged through any console log instance.</para>
 /// </summary>
 public static void UpdateGlobalSettings([NotNull] ConsoleLogGlobalSettings newSettings) =>
 DefaultMuxerProvider.UpdateSettings(newSettings);