Skip to content

Commit

Permalink
Remove "basic" logging configuration (#155)
Browse files Browse the repository at this point in the history
This function call has global side-effects on the `logging` module and
is therefor inappropriate for use within utility code.

Configure this project's logging interface with a dedicated output
stream which is independent from those that may be in use by the
consuming code.

> ### `logging.basicConfig([**kwargs])`
>
> Does basic configuration for the logging system by creating a
> `StreamHandler` with a default `Formatter` and adding it to the root
> logger. The functions `debug()`, `info()`, `warning(`), `error()` and
> `critical()` will call `basicConfig()` automatically if no handlers
> are defined for the root logger.

source: https://docs.python.org/2/library/logging.html#logging.basicConfig
  • Loading branch information
jugglinmike authored and jgraham committed Feb 1, 2017
1 parent b7e3515 commit 1cd1a1a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion manifest/log.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import logging
import sys

logging.basicConfig()
logger = logging.getLogger("manifest")
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
formatter = logging.Formatter(logging.BASIC_FORMAT, None)
handler.setFormatter(formatter)
logger.addHandler(handler)

def get_logger():
return logger

0 comments on commit 1cd1a1a

Please sign in to comment.