summaryrefslogtreecommitdiff
path: root/bs4/dammit.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2016-07-17 15:14:20 -0400
committerLeonard Richardson <leonardr@segfault.org>2016-07-17 15:14:20 -0400
commitc318323a1b097773953d125d2a53f0da23945ea9 (patch)
tree21873633018df5018406336d5cd75292fb312606 /bs4/dammit.py
parent63324b9c60387f9940e95f8e03fcdd6f3d23ba25 (diff)
downloadbeautifulsoup4-c318323a1b097773953d125d2a53f0da23945ea9.tar.gz
Use a dedicated logger instead of the root logger. [bug=1511661]
Diffstat (limited to 'bs4/dammit.py')
-rw-r--r--bs4/dammit.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/bs4/dammit.py b/bs4/dammit.py
index 9b6e356..cec0809 100644
--- a/bs4/dammit.py
+++ b/bs4/dammit.py
@@ -347,7 +347,7 @@ class UnicodeDammit:
self.tried_encodings = []
self.contains_replacement_characters = False
self.is_html = is_html
-
+ self.log = logging.getLogger(__name__)
self.detector = EncodingDetector(
markup, override_encodings, is_html, exclude_encodings)
@@ -377,9 +377,10 @@ class UnicodeDammit:
if encoding != "ascii":
u = self._convert_from(encoding, "replace")
if u is not None:
- logging.warning(
+ self.log.warn(
"Some characters could not be decoded, and were "
- "replaced with REPLACEMENT CHARACTER.")
+ "replaced with REPLACEMENT CHARACTER."
+ )
self.contains_replacement_characters = True
break