HENNGE / arsenic

Async WebDriver implementation for asyncio and asyncio-compatible frameworks
Other
351 stars 54 forks source link

Remove structlog #113

Open dimaqq opened 3 years ago

dimaqq commented 3 years ago

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.

hexdex22 commented 3 years ago

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.

RevoltSecurities commented 5 months ago
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 commented 5 months ago

Correction its: sys.stderr