mirror of
https://github.com/django/daphne.git
synced 2024-11-22 07:56:34 +03:00
Logging to the python standard library
This commit is contained in:
parent
0844061296
commit
cf096bab5c
|
@ -2,7 +2,7 @@ import logging
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
from twisted.internet import reactor, defer
|
from twisted.internet import reactor, defer
|
||||||
from twisted.logger import globalLogBeginner
|
from twisted.logger import globalLogBeginner, STDLibLogObserver
|
||||||
|
|
||||||
from .http_protocol import HTTPFactory
|
from .http_protocol import HTTPFactory
|
||||||
|
|
||||||
|
@ -59,6 +59,8 @@ class Server(object):
|
||||||
if self.verbosity <= 1:
|
if self.verbosity <= 1:
|
||||||
# Redirect the Twisted log to nowhere
|
# Redirect the Twisted log to nowhere
|
||||||
globalLogBeginner.beginLoggingTo([lambda _: None], redirectStandardIO=False, discardBuffer=True)
|
globalLogBeginner.beginLoggingTo([lambda _: None], redirectStandardIO=False, discardBuffer=True)
|
||||||
|
else:
|
||||||
|
globalLogBeginner.beginLoggingTo([STDLibLogObserver(__name__)])
|
||||||
# Listen on a socket
|
# Listen on a socket
|
||||||
if self.unix_socket:
|
if self.unix_socket:
|
||||||
reactor.listenUNIX(self.unix_socket, self.factory)
|
reactor.listenUNIX(self.unix_socket, self.factory)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user