Merge pull request #795 from ekampf/patch-1
Prevent `run` from overriding logging config set in constructor
This commit is contained in:
commit
6dc569cde5
|
@ -545,7 +545,7 @@ class Sanic:
|
||||||
def run(self, host=None, port=None, debug=False, ssl=None,
|
def run(self, host=None, port=None, debug=False, ssl=None,
|
||||||
sock=None, workers=1, protocol=None,
|
sock=None, workers=1, protocol=None,
|
||||||
backlog=100, stop_event=None, register_sys_signals=True,
|
backlog=100, stop_event=None, register_sys_signals=True,
|
||||||
log_config=LOGGING):
|
log_config=None):
|
||||||
"""Run the HTTP Server and listen until keyboard interrupt or term
|
"""Run the HTTP Server and listen until keyboard interrupt or term
|
||||||
signal. On termination, drain connections before closing.
|
signal. On termination, drain connections before closing.
|
||||||
|
|
||||||
|
@ -567,6 +567,7 @@ class Sanic:
|
||||||
host, port = host or "127.0.0.1", port or 8000
|
host, port = host or "127.0.0.1", port or 8000
|
||||||
|
|
||||||
if log_config:
|
if log_config:
|
||||||
|
self.log_config = log_config
|
||||||
logging.config.dictConfig(log_config)
|
logging.config.dictConfig(log_config)
|
||||||
if protocol is None:
|
if protocol is None:
|
||||||
protocol = (WebSocketProtocol if self.websocket_enabled
|
protocol = (WebSocketProtocol if self.websocket_enabled
|
||||||
|
@ -580,7 +581,7 @@ class Sanic:
|
||||||
host=host, port=port, debug=debug, ssl=ssl, sock=sock,
|
host=host, port=port, debug=debug, ssl=ssl, sock=sock,
|
||||||
workers=workers, protocol=protocol, backlog=backlog,
|
workers=workers, protocol=protocol, backlog=backlog,
|
||||||
register_sys_signals=register_sys_signals,
|
register_sys_signals=register_sys_signals,
|
||||||
has_log=log_config is not None)
|
has_log=self.log_config is not None)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.is_running = True
|
self.is_running = True
|
||||||
|
|
Loading…
Reference in New Issue
Block a user