chiark / gitweb /
hippotatd: support syslog
[hippotat.git] / hippotatlib / __init__.py
index 0125ece06af820f64b2076fa51fde34b1be75e58..7bdf4ea8e1730e49150933f56e08716c3424c3c0 100644 (file)
@@ -5,22 +5,22 @@
 #
 # Copyright 2017 Ian Jackson
 #
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version, with the "CAF Login
-# Exception" as published by Ian Jackson (version 2, or at your option
-# any later version) as an Additional Permission.
+# GPLv3+
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Affero General Public License for more details.
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
 #
-# You should have received a copy of the GNU Affero General Public
-# License and the CAF Login Exception along with this program, in the
-# file AGPLv3+CAFv2.  If not, email Ian Jackson
-# <ijackson@chiark.greenend.org.uk>.
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program, in the file GPLv3.  If not,
+#    see <http://www.gnu.org/licenses/>.
+
 
 import signal
 signal.signal(signal.SIGINT, signal.SIG_DFL)
@@ -567,7 +567,8 @@ def common_startup(process_cfg):
 
   def ds_default(od,os,dl,op):
     global debug_set
-    debug_set = set(dfs_less_detailed(debug_def_detail))
+    debug_set.clear
+    debug_set |= set(dfs_less_detailed(debug_def_detail))
 
   def ds_select(od,os, spec, op):
     for it in spec.split(','):
@@ -633,13 +634,14 @@ just `+': all DFLAGs.
 
   try:
     (pss, pcs) = _cfg_process_putatives()
-    process_cfg(pss, pcs)
+    process_cfg(opts, pss, pcs)
   except (configparser.Error, ValueError):
     traceback.print_exc(file=sys.stderr)
     print('\nInvalid configuration, giving up.', file=sys.stderr)
     sys.exit(12)
 
-  #print(repr(debug_set), file=sys.stderr)
+
+  #print('X', debug_set, file=sys.stderr)
 
   log_formatter = twisted.logger.formatEventAsClassicLogText
   stdout_obs = twisted.logger.FileLogObserver(sys.stdout, log_formatter)
@@ -648,12 +650,13 @@ just `+': all DFLAGs.
   stdsomething_obs = twisted.logger.FilteringLogObserver(
     stderr_obs, [pred], stdout_obs
   )
-  log_observer = twisted.logger.FilteringLogObserver(
+  global file_log_observer
+  file_log_observer = twisted.logger.FilteringLogObserver(
     stdsomething_obs, [LogNotBoringTwisted()]
   )
   #log_observer = stdsomething_obs
   twisted.logger.globalLogBeginner.beginLoggingTo(
-    [ log_observer, crash_on_critical ]
+    [ file_log_observer, crash_on_critical ]
     )
 
 def common_run():