Simple wrapper for built-in logger module which intercepts all logs and shadows them, preventing sensitive information from being leaked.
pip install shadowlogger
import shadowlogger
# Activate shadowlogger
shadowlogger.manager.install()
# Deactivate shadowlogger
shadowlogger.manager.uninstall()
or
from shadowlogger.shadowlogger import ShadowLogger
class MyCustomLogger(ShadowLogger):
# override these to customize the logger
prefix: str
name: str
message_format: str
log_level: int
# override this to handle the formatted message
def handle_message(self, formatted_message: str, level_name: str):
pass
python -m unittest discover -s tests