fix slogLogger to support ParameterizedQueries Config#7574
fix slogLogger to support ParameterizedQueries Config#7574jinzhu merged 1 commit intogo-gorm:masterfrom EricWvi:fix-slogLogger
Conversation
|
This pull request introduces a ParamsFilter method to the slogLogger implementation in the logger package. The new method enables slogLogger to respect the ParameterizedQueries configuration option, ensuring that SQL parameters are filtered out from logs when this config is enabled, in alignment with other logger implementations. This summary was automatically generated by @propel-code-bot |
| // ParamsFilter filter params | ||
| func (l *slogLogger) ParamsFilter(ctx context.Context, sql string, params ...interface{}) (string, []interface{}) { | ||
| if l.Parameterized { | ||
| return sql, nil | ||
| } | ||
| return sql, params | ||
| } |
There was a problem hiding this comment.
[BestPractice]
[CodeDuplication] The ParamsFilter method is nearly identical to the existing implementation in logger/logger.go. The only difference is the field name (l.Parameterized vs l.Config.ParameterizedQueries). Consider extracting this logic to a shared utility function or ensuring consistent field naming across logger implementations to avoid code duplication.
|
Hi, @jinzhu @rezamokaram. Please take a look. |
|
ref. Lines 193 to 198 in cace4a6 |
|
Thanks for your attention and contribution. |
What did this pull request do?
Add ParamsFilter method to slogLogger
User Case Description
After update,
logger.NewSlogLoggersupportsParameterizedQueries. Now, it has no effect.