Describe the feature
Currently, when running with Logger enabled, it will log full SQL statement, ex:
SELECT * FROM "api_keys" WHERE access_token = 'MySecretAPIKeyValue'
Logger should have a toggle option to instead log SQL statements without args:
logger.Config {
LogVariables: false
}
SELECT * FROM "api_keys" WHERE access_token = ?
Motivation
Current implementation can leak sensitive info if used in production. Running with logger.Silent ii possible, but makes it harder to debug. Logging at least SQL statements without args, would add additional debugging capability.
Related Issues
Comment From: ManikantaKandagatla
@jinzhu can you guide me on some data points on how to implement this. I would like to pick this up if it is a doable change with easy understanding.
Comment From: black-06
This is a feature that has been implemented.
if logger.Config.ParameterizedQueries is true,
the logger will log sql without variables.