diff options
author | Aaron LI <aaronly.me@outlook.com> | 2016-10-17 14:43:14 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@outlook.com> | 2016-10-17 14:43:14 +0800 |
commit | a2ac8897247ff0c2be7b725111a5d8ccd9a7eb15 (patch) | |
tree | c1f20a50d672ba6f8732468ec2d18140327c3e16 /fg21sim/utils | |
parent | 1e3a06322ecb967b92c80ef83f0fe2c341f8adb9 (diff) | |
download | fg21sim-a2ac8897247ff0c2be7b725111a5d8ccd9a7eb15.tar.bz2 |
Force "DEBUG" log level if env variable "DEBUG_FG21SIM" set
Diffstat (limited to 'fg21sim/utils')
-rw-r--r-- | fg21sim/utils/logging.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fg21sim/utils/logging.py b/fg21sim/utils/logging.py index d2bfa1f..d539448 100644 --- a/fg21sim/utils/logging.py +++ b/fg21sim/utils/logging.py @@ -5,6 +5,7 @@ Logging utilities. """ +import os import sys import logging from logging import FileHandler, StreamHandler @@ -56,6 +57,9 @@ def setup_logging(dict_config=None, level=None, stream=None, logfile=None): # the handlers to the "root" logger. logging.basicConfig(**dict_config) # + if os.environ.get("DEBUG_FG21SIM"): + print("DEBUG: Force 'DEBUG' logging level", file=sys.stderr) + level = "DEBUG" if level is not None: level_int = getattr(logging, level.upper(), None) if not isinstance(level_int, int): |