Open bbberard opened 3 years ago
How curious. The only changes I made to detect_secrets.core.log
during the upgrade is to add type hints. I agree that our logging infrastructure should be fixed (this is a great case, thanks for the examples), but I actually don't know of any good Python logging patterns for packages.
Pull requests welcome, or any good patterns you've observed in the wild.
I'm attempting to upgrade from
detect-secrets
0.14.3 to 1.0.3, but I'm encountering a new error in the handling of the Python logger. I have code that uses the stylelogging.info()
for logging, which worked fine in 0.14.3, but does not in 1.0.3.Since this is an import-related behavior, it's really hard to fix.
Previous Behavior
Current Behavior
Attempt # 1
The first thing I tried was to configure the logger before importing
detect-secrets
:However, the logger I've configured is deleted/overwritten by
detect-secrets
.Workaround
The only way I've been able to solve this problem for now is using the below code. I cannot simply delete the handlers because if I want to run my code in an AWS Lambda, for example, there's a pre-configured logger that I would like to continue to use.