From fc5c43d217abf30f33d862c1e735e5b929bf974e Mon Sep 17 00:00:00 2001 From: liurong Date: Thu, 30 Nov 2023 17:37:15 +0800 Subject: [PATCH 1/2] fix up encryption logger level to debug mod --- common/encryption/handler.go | 4 ++-- common/encryption/kms_client.go | 8 ++++---- common/encryption/kms_plugins.go | 6 +++--- common/filter/config_encryption_filter.go | 2 +- common/filter/config_filter.go | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/common/encryption/handler.go b/common/encryption/handler.go index e2b8742e..f13fb2df 100644 --- a/common/encryption/handler.go +++ b/common/encryption/handler.go @@ -63,7 +63,7 @@ func initDefaultHandler() { defaultHandler = &DefaultHandler{ encryptionPlugins: make(map[string]Plugin, 2), } - logger.Info("successfully create encryption defaultHandler") + logger.Debug("successfully create encryption defaultHandler") }) } @@ -132,7 +132,7 @@ func (d *DefaultHandler) RegisterPlugin(plugin Plugin) error { if _, v := d.encryptionPlugins[plugin.AlgorithmName()]; v { logger.Warnf("encryption algorithm [%s] has already registered to defaultHandler, will be update", plugin.AlgorithmName()) } else { - logger.Infof("register encryption algorithm [%s] to defaultHandler", plugin.AlgorithmName()) + logger.Debugf("register encryption algorithm [%s] to defaultHandler", plugin.AlgorithmName()) } d.encryptionPlugins[plugin.AlgorithmName()] = plugin return nil diff --git a/common/encryption/kms_client.go b/common/encryption/kms_client.go index 57857403..398699cd 100644 --- a/common/encryption/kms_client.go +++ b/common/encryption/kms_client.go @@ -86,7 +86,7 @@ func InitDefaultKmsV3ClientWithConfig(config *dkms_api.Config, caVerify string) rErr = errors.Wrap(err, "init kms v3 client with config failed") } else { if len(strings.TrimSpace(caVerify)) != 0 { - logger.Infof("set kms client Ca with content: %s\n", caVerify[:len(caVerify)/maskUnit32Width]) + logger.Debugf("set kms client Ca with content: %s\n", caVerify[:len(caVerify)/maskUnit32Width]) client.SetVerify(caVerify) } else { client.SetHTTPSInsecure(true) @@ -119,13 +119,13 @@ func GetDefaultKmsClient() *KmsClient { } func NewKmsV1ClientWithAccessKey(regionId, ak, sk string) (*KmsClient, error) { - logger.Infof("init kms client with region:[%s], ak:[%s]xxx, sk:[%s]xxx\n", + logger.Debugf("init kms client with region:[%s], ak:[%s]xxx, sk:[%s]xxx\n", regionId, ak[:len(ak)/maskUnit8Width], sk[:len(sk)/maskUnit8Width]) return newKmsClient(regionId, ak, sk, nil) } func NewKmsV3ClientWithConfig(config *dkms_api.Config) (*KmsClient, error) { - logger.Infof("init kms client with endpoint:[%s], clientKeyContent:[%s], password:[%s]\n", + logger.Debugf("init kms client with endpoint:[%s], clientKeyContent:[%s], password:[%s]\n", config.Endpoint, (*config.ClientKeyContent)[:len(*config.ClientKeyContent)/maskUnit8Width], (*config.Password)[:len(*config.Password)/maskUnit8Width]) return newKmsClient("", "", "", config) @@ -146,7 +146,7 @@ func (kmsClient *KmsClient) GetKmsVersion() constant.KMSVersion { } func (kmsClient *KmsClient) SetKmsVersion(kmsVersion constant.KMSVersion) { - logger.Info("successfully set kms client version to " + kmsVersion) + logger.Debug("successfully set kms client version to " + kmsVersion) kmsClient.kmsVersion = kmsVersion } diff --git a/common/encryption/kms_plugins.go b/common/encryption/kms_plugins.go index 1a647b16..c8402964 100644 --- a/common/encryption/kms_plugins.go +++ b/common/encryption/kms_plugins.go @@ -26,17 +26,17 @@ func init() { if err := GetDefaultHandler().RegisterPlugin(&KmsAes128Plugin{}); err != nil { logger.Errorf("failed to register encryption plugin[%s] to defaultHandler", KmsAes128AlgorithmName) } else { - logger.Infof("successfully register encryption plugin[%s] to defaultHandler", KmsAes128AlgorithmName) + logger.Debugf("successfully register encryption plugin[%s] to defaultHandler", KmsAes128AlgorithmName) } if err := GetDefaultHandler().RegisterPlugin(&KmsAes256Plugin{}); err != nil { logger.Errorf("failed to register encryption plugin[%s] to defaultHandler", KmsAes256AlgorithmName) } else { - logger.Infof("successfully register encryption plugin[%s] to defaultHandler", KmsAes256AlgorithmName) + logger.Debugf("successfully register encryption plugin[%s] to defaultHandler", KmsAes256AlgorithmName) } if err := GetDefaultHandler().RegisterPlugin(&KmsBasePlugin{}); err != nil { logger.Errorf("failed to register encryption plugin[%s] to defaultHandler", KmsAlgorithmName) } else { - logger.Infof("successfully register encryption plugin[%s] to defaultHandler", KmsAlgorithmName) + logger.Debugf("successfully register encryption plugin[%s] to defaultHandler", KmsAlgorithmName) } } diff --git a/common/filter/config_encryption_filter.go b/common/filter/config_encryption_filter.go index 11cf5f4f..010ceb7b 100644 --- a/common/filter/config_encryption_filter.go +++ b/common/filter/config_encryption_filter.go @@ -42,7 +42,7 @@ func GetDefaultConfigEncryptionFilter() IConfigFilter { if defaultConfigEncryptionFilter == nil { initDefaultConfigEncryptionFilterOnce.Do(func() { defaultConfigEncryptionFilter = &DefaultConfigEncryptionFilter{} - logger.Infof("successfully create ConfigFilter[%s]", defaultConfigEncryptionFilter.GetFilterName()) + logger.Debugf("successfully create ConfigFilter[%s]", defaultConfigEncryptionFilter.GetFilterName()) }) } return defaultConfigEncryptionFilter diff --git a/common/filter/config_filter.go b/common/filter/config_filter.go index 6ff72e9e..465e51d9 100644 --- a/common/filter/config_filter.go +++ b/common/filter/config_filter.go @@ -48,7 +48,7 @@ func init() { GetDefaultConfigEncryptionFilter().GetFilterName()) return } else { - logger.Infof("successfully register ConfigFilter[%s] to DefaultConfigFilterChainManager", GetDefaultConfigEncryptionFilter().GetFilterName()) + logger.Debugf("successfully register ConfigFilter[%s] to DefaultConfigFilterChainManager", GetDefaultConfigEncryptionFilter().GetFilterName()) } } @@ -56,7 +56,7 @@ func GetDefaultConfigFilterChainManager() IConfigFilterChain { if defaultConfigFilterChainManagerInstance == nil { initConfigFilterChainManagerOnce.Do(func() { defaultConfigFilterChainManagerInstance = newDefaultConfigFilterChainManager() - logger.Info("successfully create DefaultConfigFilterChainManager") + logger.Debugf("successfully create DefaultConfigFilterChainManager") }) } return defaultConfigFilterChainManagerInstance From 3a8ebbd0798c74fb092203ddddacca3e7184d71a Mon Sep 17 00:00:00 2001 From: liurong Date: Thu, 30 Nov 2023 17:44:06 +0800 Subject: [PATCH 2/2] fix up encryption logger level to debug mod --- common/filter/config_filter.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/filter/config_filter.go b/common/filter/config_filter.go index 465e51d9..a220b6f3 100644 --- a/common/filter/config_filter.go +++ b/common/filter/config_filter.go @@ -56,7 +56,7 @@ func GetDefaultConfigFilterChainManager() IConfigFilterChain { if defaultConfigFilterChainManagerInstance == nil { initConfigFilterChainManagerOnce.Do(func() { defaultConfigFilterChainManagerInstance = newDefaultConfigFilterChainManager() - logger.Debugf("successfully create DefaultConfigFilterChainManager") + logger.Debug("successfully create DefaultConfigFilterChainManager") }) } return defaultConfigFilterChainManagerInstance