Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove structlog #113

Open
dimaqq opened this issue Jan 12, 2021 · 3 comments
Open

Remove structlog #113

dimaqq opened this issue Jan 12, 2021 · 3 comments

Comments

@dimaqq
Copy link
Contributor

dimaqq commented Jan 12, 2021

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
Copy link

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
Copy link

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
Copy link

Correction its: sys.stderr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants