]> www.average.org Git - loctrkd.git/blobdiff - gps303/common.py
support subscriptions on the client side
[loctrkd.git] / gps303 / common.py
index 44c301d41c591bbd785ef5b077d09a9ac8f338e3..09fb01f060c73c0f0821ec84947fb435fa1344da 100644 (file)
@@ -3,6 +3,7 @@
 from configparser import ConfigParser
 from getopt import getopt
 from logging import getLogger, StreamHandler, DEBUG, INFO
+from logging.handlers import SysLogHandler
 from sys import argv, stderr, stdout
 
 CONF = "/etc/gps303.conf"
@@ -10,8 +11,9 @@ PORT = 4303
 DBFN = "/var/lib/gps303/gps303.sqlite"
 
 
-def init(log):
-    opts, _ = getopt(argv[1:], "c:d")
+def init(log, opts=None):
+    if opts is None:
+        opts, _ = getopt(argv[1:], "c:d")
     opts = dict(opts)
     conf = readconfig(opts["-c"] if "-c" in opts else CONF)
     if stdout.isatty():