refactor: place log messages in same file
This commit is contained in:
-17
@@ -89,21 +89,4 @@ internal sealed class MachineIdKeyGenerator : IMachineIdKeyGenerator
|
|||||||
_logger.LogUsingFallbackStrategy();
|
_logger.LogUsingFallbackStrategy();
|
||||||
return $"{Environment.MachineName}_{Environment.UserName}";
|
return $"{Environment.MachineName}_{Environment.UserName}";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
internal static partial class LogMessages
|
|
||||||
{
|
|
||||||
[LoggerMessage(
|
|
||||||
EventId = 1,
|
|
||||||
Level = LogLevel.Warning,
|
|
||||||
Message = "Failed to retrieve hardware-specific machine ID. Falling back to environment variables."
|
|
||||||
)]
|
|
||||||
public static partial void LogFailedRetrievingMachineId(this ILogger logger, Exception ex);
|
|
||||||
|
|
||||||
[LoggerMessage(
|
|
||||||
EventId = 2,
|
|
||||||
Level = LogLevel.Information,
|
|
||||||
Message = "Using fallback strategy for Machine ID generation."
|
|
||||||
)]
|
|
||||||
public static partial void LogUsingFallbackStrategy(this ILogger logger);
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
internal static partial class LogMessages
|
||||||
|
{
|
||||||
|
[LoggerMessage(
|
||||||
|
EventId = 1,
|
||||||
|
Level = LogLevel.Warning,
|
||||||
|
Message = "Failed to retrieve hardware-specific machine ID. Falling back to environment variables."
|
||||||
|
)]
|
||||||
|
public static partial void LogFailedRetrievingMachineId(this ILogger logger, Exception ex);
|
||||||
|
|
||||||
|
[LoggerMessage(
|
||||||
|
EventId = 2,
|
||||||
|
Level = LogLevel.Information,
|
||||||
|
Message = "Using fallback strategy for Machine ID generation."
|
||||||
|
)]
|
||||||
|
public static partial void LogUsingFallbackStrategy(this ILogger logger);
|
||||||
|
|
||||||
|
[LoggerMessage(
|
||||||
|
EventId = 3,
|
||||||
|
Level = LogLevel.Error,
|
||||||
|
Message = "Failed to decrypt value for key {Key}"
|
||||||
|
)]
|
||||||
|
public static partial void LogDecryptionFailure(this ILogger logger, Exception ex, string key);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user