Added IsEnabled to sink and update

This commit is contained in:
Ellpeck 2020-07-29 15:14:19 +02:00
parent 6b500ec693
commit cd10c083bf
2 changed files with 5 additions and 1 deletions

View file

@ -45,7 +45,7 @@ namespace ExtremelySimpleLogger {
if (!this.IsEnabled || level < this.MinimumLevel)
return;
foreach (var sink in this.Sinks) {
if (level >= sink.MinimumLevel)
if (sink.IsEnabled && level >= sink.MinimumLevel)
sink.Log(this, level, message, e);
}
}

View file

@ -16,6 +16,10 @@ namespace ExtremelySimpleLogger {
/// By default, <see cref="FormatDefault"/> is used.
/// </summary>
public LogFormatter Formatter { get; set; }
/// <summary>
/// If this property is set to <code>false</code>, this sink will not log any messages.
/// </summary>
public bool IsEnabled { get; set; } = true;
/// <summary>
/// Initializes a new sink with the default settings.