-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Solution: WatchList.Core - Add class AggregateLogging.
- Loading branch information
1 parent
41648db
commit bbb2689
Showing
4 changed files
with
55 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace WatchList.Core.Logger | ||
{ | ||
public class AggregateLogging : List<ILogger>, ILogger | ||
{ | ||
private readonly LogLevel _logLevel; | ||
Check warning on line 7 in WatchList.Core/Logger/AggregateLogging.cs GitHub Actions / build
Check warning on line 7 in WatchList.Core/Logger/AggregateLogging.cs GitHub Actions / build
Check warning on line 7 in WatchList.Core/Logger/AggregateLogging.cs GitHub Actions / build
|
||
|
||
public AggregateLogging() | ||
: base() | ||
{ | ||
} | ||
|
||
public AggregateLogging(int capacity) | ||
: base(capacity) | ||
{ | ||
} | ||
|
||
public AggregateLogging(IEnumerable<ILogger> collection) | ||
: base(collection) | ||
{ | ||
} | ||
|
||
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter) | ||
{ | ||
foreach (var loggin in this) | ||
{ | ||
loggin.Log(logLevel, eventId, state, exception, formatter); | ||
} | ||
} | ||
|
||
public bool IsEnabled(LogLevel logLevel) => _logLevel <= logLevel; | ||
|
||
public IDisposable? BeginScope<TState>(TState state) | ||
where TState : notnull | ||
=> new Disposable(); | ||
|
||
private sealed class Disposable : IDisposable | ||
{ | ||
public void Dispose() | ||
{ | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters