X-Git-Url: http://www.average.org/gitweb/?p=loctrkd.git;a=blobdiff_plain;f=gps303%2Fcommon.py;h=8afd65edfd65bd6e5efcb4b8df8234d79bccdfd4;hp=f6994ac0c39bd2bc72d493036c2ab3cbe6cae598;hb=095e50cff44cd721962b82e42205b4674c8647f1;hpb=023b996d58c9c22002f46f7187828c72110a2f38 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