forked from danijar/handout
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
logger creation removed from __init__.py
Fixes danijar#11
- Loading branch information
1 parent
c0476b8
commit 243b10b
Showing
4 changed files
with
26 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1 @@ | ||
import sys | ||
import logging | ||
|
||
from .handout import Handout | ||
|
||
|
||
# Set up logger. | ||
logger = logging.getLogger('handout') | ||
logger.setLevel(logging.INFO) | ||
logger.propagate = False # Global logger should not print messages again. | ||
handler = logging.StreamHandler(sys.stdout) | ||
handler.setFormatter(logging.Formatter('%(message)s')) | ||
logger.addHandler(handler) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import handout | ||
|
||
def test_get_logger_has_single_handler(): | ||
import handout # Simulate multiple imports of a package. | ||
import handout | ||
logger = handout.tools.get_logger() | ||
assert len(logger.handlers) == 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters