Skip to content

Commit b5f80a2

Browse files
authored
Merge pull request #122 from duncanmmacleod/root-logger
Remove Python root logger configuration
2 parents ced4471 + b8e9fff commit b5f80a2

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

htgettoken/__init__.py

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -84,21 +84,6 @@ def log(*args, **kwargs):
8484
print(" ".join(map(str,args)), file=logfile, **kwargs)
8585

8686

87-
class HtgettokenHandler(logging.StreamHandler):
88-
"""Custom logger handler for urllib3 to send output to our log function.
89-
"""
90-
def __init__(self):
91-
logging.StreamHandler.__init__(self)
92-
def emit(self, record):
93-
log(self.format(record))
94-
95-
root_logger = logging.getLogger()
96-
log_format = '%(name)s - %(levelname)s - %(message)s'
97-
log_handler = HtgettokenHandler()
98-
log_handler.setFormatter(logging.Formatter(log_format))
99-
root_logger.addHandler(log_handler)
100-
101-
10287
def logerr(*args, **kwargs):
10388
"""Always print to stderr.
10489
"""
@@ -711,10 +696,10 @@ def main(args=None):
711696
logfile=sys.stdout
712697
if options.debug:
713698
log("Enabling HTTPConnection debugging")
714-
# Unfortunately in urllib3 this only ever prints to stdout,
699+
# Unfortunately in http.client this only ever prints to stdout,
715700
# so only enable the HTTPConnection debugging when not needing
716701
# to parse stdout
717-
http.client.HTTPConnection.debuglevel = 5
702+
http.client.HTTPConnection.debuglevel = 1
718703

719704
if not options.nooidc and not sys.stdout.isatty() \
720705
and not sys.stderr.isatty() and not sys.stdin.isatty():

0 commit comments

Comments
 (0)