From 639a09bdf5c7580da96438bb282a1ddf1c8539a8 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Thu, 29 Sep 2016 18:46:14 +0800 Subject: utils/logging.py: Hack the "filemode" arg of "basicConfig()" "logging.basicConfig()" does NOT accept parameter "filemode" if the corresponding paramter "filename" NOT specified. --- fg21sim/utils/logging.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fg21sim/utils/logging.py b/fg21sim/utils/logging.py index 2b2317f..0abf4d3 100644 --- a/fg21sim/utils/logging.py +++ b/fg21sim/utils/logging.py @@ -39,8 +39,11 @@ def setup_logging(dict_config=None, level=None, stream=None, logfile=None): filemode = "a" # if dict_config: + # XXX: + # "basicConfig()" does NOT accept paramter "filemode" if the + # corresponding parameter "filename" NOT specified. + filemode = dict_config.pop("filemode", filemode) logging.basicConfig(**dict_config) - filemode = dict_config["filemode"] # root_logger = logging.getLogger() # -- cgit v1.2.2