diff --git a/src/StevanFreeborn.Extensions.Configuration.Secure/Cryptography/MachineIdKeyGenerator.cs b/src/StevanFreeborn.Extensions.Configuration.Secure/Cryptography/MachineIdKeyGenerator.cs index 93e4673..239ea90 100644 --- a/src/StevanFreeborn.Extensions.Configuration.Secure/Cryptography/MachineIdKeyGenerator.cs +++ b/src/StevanFreeborn.Extensions.Configuration.Secure/Cryptography/MachineIdKeyGenerator.cs @@ -89,21 +89,4 @@ internal sealed class MachineIdKeyGenerator : IMachineIdKeyGenerator _logger.LogUsingFallbackStrategy(); 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); } \ No newline at end of file diff --git a/src/StevanFreeborn.Extensions.Configuration.Secure/Logging/LogMessages.cs b/src/StevanFreeborn.Extensions.Configuration.Secure/Logging/LogMessages.cs new file mode 100644 index 0000000..65afb63 --- /dev/null +++ b/src/StevanFreeborn.Extensions.Configuration.Secure/Logging/LogMessages.cs @@ -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); +} \ No newline at end of file