aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/configs
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-10-17 14:43:14 +0800
committerAaron LI <aaronly.me@outlook.com>2016-10-17 14:43:14 +0800
commita2ac8897247ff0c2be7b725111a5d8ccd9a7eb15 (patch)
treec1f20a50d672ba6f8732468ec2d18140327c3e16 /fg21sim/configs
parent1e3a06322ecb967b92c80ef83f0fe2c341f8adb9 (diff)
downloadfg21sim-a2ac8897247ff0c2be7b725111a5d8ccd9a7eb15.tar.bz2
Force "DEBUG" log level if env variable "DEBUG_FG21SIM" set
Diffstat (limited to 'fg21sim/configs')
-rw-r--r--fg21sim/configs/manager.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/fg21sim/configs/manager.py b/fg21sim/configs/manager.py
index 64bace4..5ee4ecf 100644
--- a/fg21sim/configs/manager.py
+++ b/fg21sim/configs/manager.py
@@ -12,6 +12,7 @@ Configuration manager.
import os
import sys
import logging
+from logging import FileHandler, StreamHandler
from functools import reduce
import pkg_resources
@@ -265,8 +266,11 @@ class ConfigManager:
giving ``format`` and ``datefmt`` for each handlers if necessary,
and then adding the handlers to the "root" logger.
"""
- from logging import FileHandler, StreamHandler
conf = self.get("logging")
+ level = conf["level"]
+ if os.environ.get("DEBUG_FG21SIM"):
+ print("DEBUG: Force 'DEBUG' logging level", file=sys.stderr)
+ level = "DEBUG"
# logging handlers
handlers = []
stream = conf["stream"]
@@ -278,7 +282,7 @@ class ConfigManager:
handlers.append(FileHandler(logfile, mode=filemode))
#
logconf = {
- "level": getattr(logging, conf["level"]),
+ "level": getattr(logging, level),
"format": conf["format"],
"datefmt": conf["datefmt"],
"filemode": filemode,