From 56ed0976218c90caf6b01c532c1570d44499a7aa Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Mon, 7 Nov 2016 15:11:32 +0800 Subject: configs: Change "logging/filemode" to boolean "logging/appendmode" * Update the "logging" property in "manager.py" * Also add "extragalactic/clusters" to "common/components" --- fg21sim/configs/00-general.conf.spec | 6 +++--- fg21sim/configs/manager.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fg21sim/configs/00-general.conf.spec b/fg21sim/configs/00-general.conf.spec index e4a603a..bb4cbc8 100644 --- a/fg21sim/configs/00-general.conf.spec +++ b/fg21sim/configs/00-general.conf.spec @@ -26,7 +26,7 @@ lmax = integer(min=1, default=3071) # Diffuse Galactic free-free emission # + galactic/snr: # Galactic supernova remnants emission -components = force_list(default=list("galactic/synchrotron", "galactic/freefree", "galactic/snr")) +components = force_list(default=list("galactic/synchrotron", "galactic/freefree", "galactic/snr", "extragalactic/clusters")) # Frequencies specification of the simulation products @@ -116,8 +116,8 @@ datefmt = string(default="%Y-%m-%dT%H:%M:%S") # Set the logging filename (will create a `FileHandler`) # If set to "" (empty string), then the `FileHandler` will be disabled. filename = string(default="") -# Set the mode to open the above logging file (default: "append" mode) -filemode = option("w", "a", default="a") +# Whether append messages to the above logging file instead of overwrite +appendmode = boolean(default=True) # Set the stream used to initialize the `StreamHandler` # If set to "" (empty string), then the `StreamHandler` will be disabled. diff --git a/fg21sim/configs/manager.py b/fg21sim/configs/manager.py index c03222d..28ff24d 100644 --- a/fg21sim/configs/manager.py +++ b/fg21sim/configs/manager.py @@ -486,7 +486,7 @@ class ConfigManager: if stream: handlers.append(StreamHandler(getattr(sys, stream))) logfile = conf["filename"] - filemode = conf["filemode"] + filemode = "a" if conf["appendmode"] else "w" if logfile: handlers.append(FileHandler(logfile, mode=filemode)) # -- cgit v1.2.2