Describe the bug A clear and concise description of what the bug is.
There is no way to disable logging of blib2to3.pgen2.driver class as the logger is created in the __init__ method and the optional logger isn't passed into the class from the top level black module. (driver is created on line 1130)
To Reproduce Steps to reproduce the behavior:
Anytime the format_str() function is called you get logging like
2021-03-23 18:52:48 blib2to3.pgen2.driver[86854] INFO Generating grammar tables from <filepath>
2021-03-23 18:52:48 blib2to3.pgen2.driver[86854] INFO Writing grammar tables to <filepath>
2021-03-23 18:52:48 blib2to3.pgen2.driver[86854] INFO Writing failed: [Errno 2] No such file or directory: '<filepath>
2021-03-23 18:52:48 blib2to3.pgen2.driver[86854] INFO Writing grammar tables to <filepath>
2021-03-23 18:52:48 blib2to3.pgen2.driver[86854] INFO Writing failed: [Errno 2] No such file or directory: <filepath>
The code I'm using is
from black import format_str, FileMode
format_str(out_string, mode=FileMode())
Expected behavior A clear and concise description of what you expected to happen.
using something like
import logging
logger = logging.getLogger("black")
logger.setLevel(logging.ERROR)
or even
import logging
logger = logging.getLogger("blib2to3")
logger.setLevel(logging.ERROR)
would disable logging
Environment (please complete the following information):
- Version: 19.10b0
- OS and Python version: Mac osx 3.6.9
Does this bug also happen on master? To answer this, you have two options:
The code still has logger being created in init on master so this problem still exists.
Additional context Add any other context about the problem here.
Describe the bug A clear and concise description of what the bug is.
There is no way to disable logging of
blib2to3.pgen2.driverclass as the logger is created in the__init__method and the optional logger isn't passed into the class from the top level black module. (driver is created on line 1130)To Reproduce Steps to reproduce the behavior:
Anytime the format_str() function is called you get logging like
The code I'm using is
Expected behavior A clear and concise description of what you expected to happen.
using something like
or even
would disable logging
Environment (please complete the following information):
Does this bug also happen on master? To answer this, you have two options:
The code still has logger being created in init on master so this problem still exists.
Additional context Add any other context about the problem here.