From d6090aaa369bc0c1035f8f810817cb98b6b40862 Mon Sep 17 00:00:00 2001 From: Louie Farol Date: Fri, 6 Dec 2024 14:38:47 -0800 Subject: [PATCH] Move masking secrets --- Snowflake.Data/Logger/SFLoggerImpl.cs | 5 ----- Snowflake.Data/Logger/SFLoggerPair.cs | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Snowflake.Data/Logger/SFLoggerImpl.cs b/Snowflake.Data/Logger/SFLoggerImpl.cs index 5fa4b0431..91f934fb5 100644 --- a/Snowflake.Data/Logger/SFLoggerImpl.cs +++ b/Snowflake.Data/Logger/SFLoggerImpl.cs @@ -127,7 +127,6 @@ public void Debug(string msg, Exception ex = null) { if (IsDebugEnabled()) { - msg = SecretDetector.MaskSecrets(msg).maskedText; Log(LoggingEvent.DEBUG.ToString(), msg, ex); } } @@ -136,7 +135,6 @@ public void Information(string msg, Exception ex = null) { if (IsInformationEnabled()) { - msg = SecretDetector.MaskSecrets(msg).maskedText; Log(LoggingEvent.INFO.ToString(), msg, ex); } } @@ -145,7 +143,6 @@ public void Warning(string msg, Exception ex = null) { if (IsWarningEnabled()) { - msg = SecretDetector.MaskSecrets(msg).maskedText; Log(LoggingEvent.WARN.ToString(), msg, ex); } } @@ -155,7 +152,6 @@ public void Error(string msg, Exception ex = null) { if (IsErrorEnabled()) { - msg = SecretDetector.MaskSecrets(msg).maskedText; Log(LoggingEvent.ERROR.ToString(), msg, ex); } } @@ -164,7 +160,6 @@ public void Fatal(string msg, Exception ex = null) { if (IsFatalEnabled()) { - msg = SecretDetector.MaskSecrets(msg).maskedText; Log(LoggingEvent.FATAL.ToString(), msg, ex); } } diff --git a/Snowflake.Data/Logger/SFLoggerPair.cs b/Snowflake.Data/Logger/SFLoggerPair.cs index f8c64c0b3..4ada281ac 100644 --- a/Snowflake.Data/Logger/SFLoggerPair.cs +++ b/Snowflake.Data/Logger/SFLoggerPair.cs @@ -26,24 +26,28 @@ internal static SFLoggerPair GetLoggerPair() internal void LogDebug(string message, Exception ex = null) { + message = SecretDetector.MaskSecrets(message).maskedText; s_snowflakeLogger.Debug(message, ex); s_customLogger.LogDebug(FormatBrackets(message), ex); } internal void LogInformation(string message, Exception ex = null) { + message = SecretDetector.MaskSecrets(message).maskedText; s_snowflakeLogger.Information(message, ex); s_customLogger.LogInformation(message, ex); } internal void LogWarning(string message, Exception ex = null) { + message = SecretDetector.MaskSecrets(message).maskedText; s_snowflakeLogger.Warning(message, ex); s_customLogger.LogWarning(message, ex); } internal void LogError(string message, Exception ex = null) { + message = SecretDetector.MaskSecrets(message).maskedText; s_snowflakeLogger.Error(message, ex); s_customLogger.LogError(message, ex); }