From: Eugene Crosser Date: Fri, 27 May 2022 17:50:55 +0000 (+0200) Subject: Do not write startup message for command-line cmds X-Git-Tag: 0.96~19 X-Git-Url: http://www.average.org/gitweb/?p=loctrkd.git;a=commitdiff_plain;h=095e50cff44cd721962b82e42205b4674c8647f1 Do not write startup message for command-line cmds --- diff --git a/gps303/common.py b/gps303/common.py index f6994ac..8afd65e 100644 --- a/gps303/common.py +++ b/gps303/common.py @@ -22,20 +22,21 @@ def init(log, opts=None): opts, _ = getopt(argv[1:], "c:d") opts = dict(opts) conf = readconfig(opts["-c"] if "-c" in opts else CONF) + log.setLevel(DEBUG if "-d" in opts else INFO) if stdout.isatty(): hdl = StreamHandler(stderr) hdl.setFormatter( Formatter("%(asctime)s - %(levelname)s - %(message)s") ) log.addHandler(hdl) + log.debug("%s starting with options: %s", version, opts) else: hdl = SysLogHandler(address="/dev/log") hdl.setFormatter( Formatter("%(name)s[%(process)d]: %(levelname)s - %(message)s") ) log.addHandler(hdl) - log.setLevel(DEBUG if "-d" in opts else INFO) - log.info("%s starting with options: %s", version, opts) + log.info("%s starting with options: %s", version, opts) return conf