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

logging - printing the whole HTML text from a request is not 'INFO' #124

Open
hexdex22 opened this issue May 14, 2021 · 4 comments
Open

Comments

@hexdex22
Copy link

The volume of logging output from this library is unbearable. A simple request outputs hundreds of lines of HTML.
Real errors and messages get buried in 'INFO'

Please fix this issue or supply a simple workaround.

Have tried workarounds suggested by others and read the
structlog documentation - didn't work :(

Thanks,

Raj

P.S. I'm new to programming so might have missed something.

@dimaqq
Copy link
Contributor

dimaqq commented May 14, 2021

PRs are welcome!

@hexdex22
Copy link
Author

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 hexdex22 reopened this May 16, 2021
@seventh-attempt
Copy link

I did it like this

from contextlib import redirect_stderr, redirect_stdout
import os

with open(os.devnull, 'w') as null_output_file:
    # redirects all info- and error- level output to null
    with redirect_stderr(null_output_file), redirect_stdout(null_output_file):
        func_that_uses_arsenic(params)

This code significantly reduces the amount of output, though some messages, like Only local connections are allowed. are still present in the console.

@dejmail
Copy link

dejmail commented Sep 2, 2022

I turned down the logging level of structlog like this -

import structlog
    structlog.configure(
    wrapper_class=structlog.make_filtering_bound_logger(logging.ERROR),
    )

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

No branches or pull requests

4 participants