-
-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f7a3334
commit 2d08df5
Showing
8 changed files
with
201 additions
and
62 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace VkNet.Infrastructure; | ||
|
||
/// <summary> | ||
/// Minimalistic logger that does nothing. | ||
/// </summary> | ||
public class NullLogger : ILogger | ||
{ | ||
/// <summary> | ||
/// Returns an instance of <see cref="NullLogger" />. | ||
/// </summary> | ||
/// <returns> An instance of <see cref="NullLogger" />. </returns> | ||
public static readonly NullLogger Instance = new(); | ||
|
||
/// <inheritdoc /> | ||
public IDisposable BeginScope<TState>(TState state) | ||
where TState : notnull => NullScope.Instance; | ||
|
||
/// <inheritdoc /> | ||
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, System.Exception exception, | ||
Func<TState, System.Exception, string> formatter) | ||
{ | ||
} | ||
|
||
/// <inheritdoc /> | ||
public bool IsEnabled(LogLevel logLevel) => false; | ||
} |
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,23 @@ | ||
using System; | ||
|
||
namespace VkNet.Infrastructure; | ||
|
||
/// <summary> | ||
/// An empty scope without any logic | ||
/// </summary> | ||
internal sealed class NullScope : IDisposable | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the | ||
/// </summary> | ||
public static NullScope Instance { get; } = new(); | ||
|
||
private NullScope() | ||
{ | ||
} | ||
|
||
/// <inheritdoc /> | ||
public void Dispose() | ||
{ | ||
} | ||
} |
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
Oops, something went wrong.