Skip to content

Commit 5f0c089

Browse files
committed
BF: reincarnate logging
Many messages just need to be downgraded to DEBUG level and additional care should be taken about logging configuration for other modules we use. But in general -- we do need logging and should be able to control it from the environment variables for e.g. tuning it up quickly during test runs
1 parent 9d6cd9e commit 5f0c089

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

heudiconv/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# set logger handler
22
import logging
3-
logging.getLogger(__name__).addHandler(logging.NullHandler())
4-
3+
import os
54
from .info import (__version__, __packagename__)
5+
6+
# Rudimentary logging support.
7+
lgr = logging.getLogger(__name__)
8+
logging.basicConfig(
9+
format='%(levelname)s: %(message)s',
10+
level=getattr(logging, os.environ.get('HEUDICONV_LOG_LEVEL', 'INFO'))
11+
)
12+
lgr.debug("Starting the abomination") # just to "run-test" logging

0 commit comments

Comments
 (0)