Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug fix] fix up encryption logger level to debug mod #688

Merged
merged 2 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions common/encryption/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
})
}

Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions common/encryption/kms_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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
}

Expand Down
6 changes: 3 additions & 3 deletions common/encryption/kms_plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

}
}
Expand Down
2 changes: 1 addition & 1 deletion common/filter/config_encryption_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions common/filter/config_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ 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())
}
}

func GetDefaultConfigFilterChainManager() IConfigFilterChain {
if defaultConfigFilterChainManagerInstance == nil {
initConfigFilterChainManagerOnce.Do(func() {
defaultConfigFilterChainManagerInstance = newDefaultConfigFilterChainManager()
logger.Info("successfully create DefaultConfigFilterChainManager")
logger.Debug("successfully create DefaultConfigFilterChainManager")
})
}
return defaultConfigFilterChainManagerInstance
Expand Down
Loading