-
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed unnecessary instances and simplified LogProviders + RuntimeOp…
…tions (#304) * Removed unnecessary instances and simplified LogProviders + RuntimeOptions * Changed logger provider to return IDisposable
- Loading branch information
1 parent
b456f6e
commit db4a246
Showing
17 changed files
with
131 additions
and
146 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
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
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
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,26 @@ | ||
// Licensed under the MIT license: https://opensource.org/licenses/MIT | ||
|
||
namespace Whisper.net.Logger; | ||
|
||
internal class WhisperLogger : IDisposable | ||
{ | ||
private readonly Action<WhisperLogLevel, string?> logAction; | ||
|
||
public WhisperLogger(Action<WhisperLogLevel, string?> logAction) | ||
{ | ||
this.logAction = logAction; | ||
OnLog += logAction; | ||
} | ||
|
||
public static event Action<WhisperLogLevel, string?>? OnLog; | ||
|
||
public void Dispose() | ||
{ | ||
OnLog -= logAction; | ||
} | ||
|
||
public static void Log(WhisperLogLevel level, string? message) | ||
{ | ||
OnLog?.Invoke(level, message); | ||
} | ||
} |
Oops, something went wrong.