mirror of
https://github.com/django/daphne.git
synced 2024-11-25 01:03:45 +03:00
Add verbosity to log twisted log
This commit is contained in:
parent
c6270e7e4e
commit
0844061296
|
@ -153,4 +153,5 @@ class CommandLineInterface(object):
|
|||
action_logger=AccessLogGenerator(access_log_stream) if access_log_stream else None,
|
||||
ws_protocols=args.ws_protocols,
|
||||
root_path=args.root_path,
|
||||
verbosity=args.verbosity,
|
||||
).run()
|
||||
|
|
|
@ -26,6 +26,7 @@ class Server(object):
|
|||
ping_timeout=30,
|
||||
ws_protocols=None,
|
||||
root_path="",
|
||||
verbosity=None
|
||||
):
|
||||
self.channel_layer = channel_layer
|
||||
self.host = host
|
||||
|
@ -42,6 +43,7 @@ class Server(object):
|
|||
self.websocket_timeout = websocket_timeout or getattr(channel_layer, "group_expiry", 86400)
|
||||
self.ws_protocols = ws_protocols
|
||||
self.root_path = root_path
|
||||
self.verbosity = verbosity
|
||||
|
||||
def run(self):
|
||||
self.factory = HTTPFactory(
|
||||
|
@ -54,8 +56,9 @@ class Server(object):
|
|||
ws_protocols=self.ws_protocols,
|
||||
root_path=self.root_path,
|
||||
)
|
||||
# Redirect the Twisted log to nowhere
|
||||
globalLogBeginner.beginLoggingTo([lambda _: None], redirectStandardIO=False, discardBuffer=True)
|
||||
if self.verbosity <= 1:
|
||||
# Redirect the Twisted log to nowhere
|
||||
globalLogBeginner.beginLoggingTo([lambda _: None], redirectStandardIO=False, discardBuffer=True)
|
||||
# Listen on a socket
|
||||
if self.unix_socket:
|
||||
reactor.listenUNIX(self.unix_socket, self.factory)
|
||||
|
|
Loading…
Reference in New Issue
Block a user