-
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.
Use high performance logging in RedisCache.
- Loading branch information
Showing
5 changed files
with
49 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System.Net; | ||
using Microsoft.Extensions.Logging; | ||
using StackExchange.Redis; | ||
|
||
namespace Sagara.Core.Caching; | ||
|
||
/// <summary> | ||
/// High-performance logging for ASP.NET Core. See: https://learn.microsoft.com/en-us/dotnet/core/extensions/logger-message-generator | ||
/// </summary> | ||
internal static partial class RedisCacheLogger | ||
{ | ||
[LoggerMessage(EventId = 0, Level = LogLevel.Error, Message = "{LogPrefix}ConnectionFailed: Connection type '{ConnectionType}' on EndPoint '{EndPoint}' reported ConnectionFailureType '{FailureType}'")] | ||
public static partial void OnConnectionFailed(ILogger logger, Exception? ex, string logPrefix, ConnectionType connectionType, EndPoint? endPoint, ConnectionFailureType failureType); | ||
|
||
[LoggerMessage(EventId = 0, Level = LogLevel.Information, Message = "{LogPrefix}ConnectionRestored: Connection type '{ConnectionType}' on EndPoint '{EndPoint}' reported ConnectionFailureType '{FailureType}'")] | ||
public static partial void OnConnectionRestored(ILogger logger, Exception? ex, string logPrefix, ConnectionType connectionType, EndPoint? endPoint, ConnectionFailureType failureType); | ||
|
||
[LoggerMessage(EventId = 0, Level = LogLevel.Error, Message = "{LogPrefix}ErrorMessage: Server '{EndPoint}' reported this error message: {Message}")] | ||
public static partial void OnErrorMessage(ILogger logger, string logPrefix, EndPoint? endPoint, string message); | ||
|
||
[LoggerMessage(EventId = 0, Level = LogLevel.Warning, Message = "{LogPrefix}ServerMaintenanceEvent: Server maintenance event received at {ReceivedTimeUtc}. Expected start time is {StartTimeUtc}. Raw message: {RawMessage}")] | ||
public static partial void OnServerMaintenanceEvent(ILogger logger, string logPrefix, DateTime receivedTimeUtc, DateTime? startTimeUtc, string? rawMessage); | ||
|
||
[LoggerMessage(EventId = 0, Level = LogLevel.Error, Message = "Unhandled exception trying to async {Command} {Key}")] | ||
public static partial void UnhandledException(ILogger logger, Exception ex, string command, string key); | ||
|
||
[LoggerMessage(EventId = 0, Level = LogLevel.Error, Message = "Unhandled exception trying to SUBSCRIBE {Channel}")] | ||
public static partial void UnhandledSubscribeException(ILogger logger, Exception ex, RedisChannel channel); | ||
|
||
[LoggerMessage(EventId = 0, Level = LogLevel.Error, Message = "Unhandled exception trying to async PUBLISH {Channel} {Message}")] | ||
public static partial void UnhandledPublishException(ILogger logger, Exception ex, RedisChannel channel, RedisValue message); | ||
} |
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