arsenic icon indicating copy to clipboard operation
arsenic copied to clipboard

Remove structlog

Open dimaqq opened this issue 4 years ago • 3 comments

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.

dimaqq avatar Jan 12 '21 01:01 dimaqq

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.

hexdex22 avatar May 16 '21 03:05 hexdex22

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 :)

RevoltSecurities avatar Apr 16 '24 17:04 RevoltSecurities

Correction its: sys.stderr

RevoltSecurities avatar Apr 16 '24 17:04 RevoltSecurities