public bool TryLog(LogEvent @event, ConsoleLogSettings settings) { if (!isInitialized) { Initialize(); } var eventInfo = new LogEventInfo(@event, settings); if (!events.TryAdd(eventInfo)) { Interlocked.Increment(ref eventsLost); return(false); } return(true); }
public static ConsoleLogSettings ValidateInstanceSettings(ConsoleLogSettings settings) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } if (settings.OutputTemplate == null) { throw new ArgumentNullException(nameof(settings.OutputTemplate)); } if (settings.ColorMapping == null) { throw new ArgumentNullException(nameof(settings.ColorMapping)); } return(settings); }
/// <summary> /// <para>Create a new console log with the given settings.</para> /// <para>An exception will be thrown if the provided <paramref name="settings" /> are invalid.</para> /// </summary> public SynchronousConsoleLog([NotNull] ConsoleLogSettings settings) { this.settings = SettingsValidator.ValidateInstanceSettings(settings); consoleFeaturesDetector = new ConsoleFeaturesDetector(); consoleColorChanger = new ConsoleColorChanger(); }
public LogEventInfo(LogEvent @event, ConsoleLogSettings settings) { Event = @event; Settings = settings; }
internal ConsoleLog(IConsoleLogMuxerProvider muxerProvider, ConsoleLogSettings settings) { this.muxerProvider = muxerProvider; this.settings = SettingsValidator.ValidateInstanceSettings(settings); }
/// <summary> /// <para>Create a new console log with the given settings.</para> /// <para>An exception will be thrown if the provided <paramref name="settings"/> are invalid.</para> /// </summary> public ConsoleLog([NotNull] ConsoleLogSettings settings) : this(DefaultMuxerProvider, settings) { }