chiark / gitweb /
log diversion stdout
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 2 Apr 2017 00:47:26 +0000 (01:47 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 2 Apr 2017 00:47:26 +0000 (01:47 +0100)
hippotat/__init__.py

index 1e8a23f..fa43065 100644 (file)
@@ -369,7 +369,12 @@ def process_cfg_clients(constructor):
 
 def common_startup():
   log_formatter = twisted.logger.formatEventAsClassicLogText
-  log_observer = twisted.logger.FileLogObserver(sys.stderr, log_formatter)
+  stdout_obs = twisted.logger.FileLogObserver(sys.stdout, log_formatter)
+  stderr_obs = twisted.logger.FileLogObserver(sys.stderr, log_formatter)
+  pred = twisted.logger.LogLevelFilterPredicate(LogLevel.error)
+  log_observer = twisted.logger.FilteringLogObserver(
+    stderr_obs, [pred], stdout_obs
+  )
   twisted.logger.globalLogBeginner.beginLoggingTo(
     [ log_observer, crash_on_critical ]
     )