Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9784518

Browse filesBrowse files
committed
Make logging opt-in
1 parent 9385667 commit 9784518
Copy full SHA for 9784518

File tree

Expand file treeCollapse file tree

1 file changed

+9
-8
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-8
lines changed

‎sanity_html/logger.py

Copy file name to clipboard
+9-8Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
"""
2+
Logging setup.
3+
4+
The rest of the code gets the logger through this module rather than
5+
`logging.getLogger` to make sure that it is configured.
6+
"""
17
import logging
2-
import sys
38

49
logger = logging.getLogger('sanity_html')
510

6-
# Make logger output to stdout
7-
logger.setLevel(logging.DEBUG)
8-
handler = logging.StreamHandler(sys.stdout)
9-
handler.setLevel(logging.DEBUG)
10-
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
11-
handler.setFormatter(formatter)
12-
logger.addHandler(handler)
11+
if not logger.handlers: # pragma: no cover
12+
logger.setLevel(logging.WARNING)
13+
logger.addHandler(logging.NullHandler())

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.