core (logging): logging is added to stdout in nodaemon mode (it was already the case in debug mode)
This commit is contained in:
parent
218a4122e6
commit
5342de1031
1 changed files with 9 additions and 4 deletions
|
|
@ -187,10 +187,15 @@ class ConfigureTwisted(ConfigureBasic):
|
|||
addObserver = self.twisted_log.addObserver
|
||||
|
||||
if C.LOG_OPT_OUTPUT_DEFAULT in log.handlers:
|
||||
# default output is already managed, we just add output to stdout if we are in debug mode
|
||||
from twisted.internet import defer
|
||||
if defer.Deferred.debug:
|
||||
addObserver(self.twisted_log.FileLogObserver(sys.stdout).emit)
|
||||
# default output is already managed, we just add output to stdout if we are in debug or nodaemon mode
|
||||
|
||||
# XXX: this hack is to know if we are in debug or nodaemon mode
|
||||
# any better method welcomed
|
||||
from twisted.scripts import twistd
|
||||
options = twistd.ServerOptions()
|
||||
options.parseOptions()
|
||||
if options.get('nodaemon', False) or options.get('debug', False):
|
||||
addObserver(self.twisted_log.FileLogObserver(sys.stdout).emit)
|
||||
else:
|
||||
# \\default is not in the output, so we remove current observers
|
||||
self.cleared_observers = self.log_publisher.observers
|
||||
|
|
|
|||
Loading…
Reference in a new issue