aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-10-04 13:36:59 +0800
committerAaron LI <aly@aaronly.me>2017-10-04 13:36:59 +0800
commita21fa84337356aeba294e00bbf63d19552d65553 (patch)
treefa7a1324d3e0050449caa8419142021f015f6b65
parentfd40bc26b473c48dfecdc544ba9bb49cc2335737 (diff)
downloadfg21sim-a21fa84337356aeba294e00bbf63d19552d65553.tar.bz2
configs: Use lower case for logging levels
-rwxr-xr-xbin/fg21sim4
-rwxr-xr-xbin/fg21sim-download-snr-data4
-rwxr-xr-xbin/healpix2hpx4
-rwxr-xr-xbin/hpx2healpix4
-rwxr-xr-xbin/zea2healpix4
-rw-r--r--fg21sim/configs/00-general.conf.spec12
-rw-r--r--fg21sim/configs/manager.py10
7 files changed, 18 insertions, 24 deletions
diff --git a/bin/fg21sim b/bin/fg21sim
index 7a20074..cce91dc 100755
--- a/bin/fg21sim
+++ b/bin/fg21sim
@@ -24,8 +24,8 @@ def main():
epilog="Set environment variable 'DEBUG_FG21SIM=1' to force debug!")
parser.add_argument("config", help="user configuration file")
parser.add_argument("-l", "--log", dest="loglevel", default=None,
- choices=["DEBUG", "INFO", "WARNING",
- "ERROR", "CRITICAL"],
+ choices=["debug", "info", "warning",
+ "error", "critical"],
help="set the log level")
parser.add_argument("-L", "--logfile", default=None,
help="filename where to save the log messages")
diff --git a/bin/fg21sim-download-snr-data b/bin/fg21sim-download-snr-data
index bf2b33d..5ce2a7f 100755
--- a/bin/fg21sim-download-snr-data
+++ b/bin/fg21sim-download-snr-data
@@ -42,8 +42,8 @@ def main():
parser.add_argument("-C", "--clobber", action="store_true",
help="overwrite the existing output file")
parser.add_argument("-l", "--log", dest="loglevel", default=None,
- choices=["DEBUG", "INFO", "WARNING",
- "ERROR", "CRITICAL"],
+ choices=["debug", "info", "warning",
+ "error", "critical"],
help="set the log level")
parser.add_argument("-L", "--logfile", default=None,
help="filename where to save the log messages")
diff --git a/bin/healpix2hpx b/bin/healpix2hpx
index 5f8e294..e34829c 100755
--- a/bin/healpix2hpx
+++ b/bin/healpix2hpx
@@ -27,8 +27,8 @@ def main():
parser.add_argument("-C", "--clobber", action="store_true",
help="overwrite the existing output file")
parser.add_argument("-l", "--log", dest="loglevel", default=None,
- choices=["DEBUG", "INFO", "WARNING",
- "ERROR", "CRITICAL"],
+ choices=["debug", "info", "warning",
+ "error", "critical"],
help="set the log level")
parser.add_argument("-L", "--logfile", default=None,
help="filename where to save the log messages")
diff --git a/bin/hpx2healpix b/bin/hpx2healpix
index 8fc8777..17389f5 100755
--- a/bin/hpx2healpix
+++ b/bin/hpx2healpix
@@ -27,8 +27,8 @@ def main():
parser.add_argument("-C", "--clobber", action="store_true",
help="overwrite the existing output file")
parser.add_argument("-l", "--log", dest="loglevel", default=None,
- choices=["DEBUG", "INFO", "WARNING",
- "ERROR", "CRITICAL"],
+ choices=["debug", "info", "warning",
+ "error", "critical"],
help="set the log level")
parser.add_argument("-L", "--logfile", default=None,
help="filename where to save the log messages")
diff --git a/bin/zea2healpix b/bin/zea2healpix
index 9f6f154..da6f488 100755
--- a/bin/zea2healpix
+++ b/bin/zea2healpix
@@ -43,8 +43,8 @@ def main():
parser.add_argument("-C", "--clobber", action="store_true",
help="overwrite the existing output file")
parser.add_argument("-l", "--log", dest="loglevel", default=None,
- choices=["DEBUG", "INFO", "WARNING",
- "ERROR", "CRITICAL"],
+ choices=["debug", "info", "warning",
+ "error", "critical"],
help="set the log level")
parser.add_argument("-L", "--logfile", default=None,
help="filename where to save the log messages")
diff --git a/fg21sim/configs/00-general.conf.spec b/fg21sim/configs/00-general.conf.spec
index fd75450..8e4ac59 100644
--- a/fg21sim/configs/00-general.conf.spec
+++ b/fg21sim/configs/00-general.conf.spec
@@ -122,17 +122,17 @@ ns = float(default=0.96, min=0.0)
# Configurations for initialization/reconfiguration of the `logging` module
[logging]
-# DEBUG: Detailed information, typically of interest only when diagnosing
+# debug: Detailed information, typically of interest only when diagnosing
# problems.
-# INFO: Confirmation that things are working as expected.
-# WARNING: An dinciation that something unexpected happended, or indicative
+# info: Confirmation that things are working as expected.
+# warning: An dinciation that something unexpected happended, or indicative
# of some problem in the near future (e.g., "disk space low").
# The software is still working as expected.
-# ERROR: Due to a more serious problem, the software has not been able to
+# error: Due to a more serious problem, the software has not been able to
# perform some function.
-# CRITICAL: A serious error, indicating that the program itself may be unable
+# critical: A serious error, indicating that the program itself may be unable
# to continue running.
-level = option("DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL", default="INFO")
+level = option("debug", "info", "warning", "error", "critical", default="info")
# Set the format of displayed messages
format = string(default="%(asctime)s [%(levelname)s] <%(name)s> %(message)s")
diff --git a/fg21sim/configs/manager.py b/fg21sim/configs/manager.py
index bfadab0..bbeabf7 100644
--- a/fg21sim/configs/manager.py
+++ b/fg21sim/configs/manager.py
@@ -519,15 +519,9 @@ class ConfigManager:
"""
Get and prepare the logging configurations for
``logging.basicConfig()`` to initialize the logging module.
-
- NOTE
- ----
- ``basicConfig()`` will automatically create a ``Formatter`` with the
- giving ``format`` and ``datefmt`` for each handlers if necessary,
- and then adding the handlers to the "root" logger.
"""
conf = self.get("logging")
- level = conf["level"]
+ level = conf["level"].upper()
if os.environ.get("DEBUG_FG21SIM"):
print("DEBUG: Force 'DEBUG' logging level", file=sys.stderr)
level = "DEBUG"
@@ -542,7 +536,7 @@ class ConfigManager:
if logfile:
handlers.append(FileHandler(logfile, mode=filemode))
- # Explicitly add formatter to each handler
+ # Explicitly add the formatter to each handler
formatter = logging.Formatter(fmt=conf["format"],
datefmt=conf["datefmt"])
for handler in handlers: