arsenic
arsenic copied to clipboard
Remove structlog
https://github.com/HDE/arsenic/issues?q=is%3Aissue+structlog
Looks like several users were caught off guard by this package using structlog
.
My gut tells me that arsenic
is a library used in a larger application (or test suite) and as such, arsenic
should not impose a choice of logging library on the user. Rather, we should use the lowest common denominator logging
probably with getLogger(__name__)
to offer least surprise and standard configuration interface to our users.
Horrible workaround that does reduce the amount of logger output:
In the files connection.py, errors.py and subprocess.py
Under the existing line: log = get_logger() Add the line log.info = lambda *args, **kwargs: True
This will overwrite the original log.info method.
Hope this helps.
import structlog
import asyncio
import sys
import logging
structlog.configure(logger_factory=structlog.stdlib.LoggerFactory(),wrapper_class=structlog.stdlib.BoundLogger)
logging.basicConfig(stream=sys.stderr, level=logging.CRITICAL)
structlog.configure(
logger_factory=structlog.stdlib.LoggerFactory(),
wrapper_class=structlog.stdlib.BoundLogger,
processors=[structlog.processors.JSONRenderer()],
context_class=dict,
)
add this peice of code when you are using arsenic so these will shutdown the log and even those critical will be redirected to os.devnill
and it worked for me well :)
Correction its: sys.stderr