Skip to content

Commit

Permalink
🎨 Fix conflicting logging usage (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ousret committed May 28, 2021
1 parent 84c4dae commit 697d5c3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions charset_normalizer/normalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@

from charset_normalizer.probe_inherent_sign import any_specified_encoding

import logging as logger
import logging

from hashlib import sha256

logger = logging.getLogger("charset_normalizer")
logger.setLevel(logging.DEBUG)

logger.basicConfig(level=logger.DEBUG, format='%(asctime)s | %(levelname)s | %(message)s')
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter('%(asctime)s | %(levelname)s | %(message)s'))
logger.addHandler(handler)


class CharsetNormalizerMatch:
Expand Down Expand Up @@ -359,7 +363,7 @@ def from_bytes(sequences, steps=10, chunk_size=512, threshold=0.20, cp_isolation
:rtype: CharsetNormalizerMatches
"""
if not explain:
logger.disable(logger.ERROR)
logger.setLevel(logging.ERROR)

if len(sequences) == 0:
return CharsetNormalizerMatch(
Expand Down

0 comments on commit 697d5c3

Please sign in to comment.