fixing small issue

This commit is contained in:
Yun Xu 2017-09-13 10:35:34 -07:00
parent 9c4b0f7b15
commit 5ee7b6caeb
2 changed files with 6 additions and 7 deletions

View File

@ -570,7 +570,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,
access_log=True, log_config=None): access_log=True):
"""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.
@ -588,7 +588,6 @@ class Sanic:
:param protocol: Subclass of asyncio protocol class :param protocol: Subclass of asyncio protocol class
:return: Nothing :return: Nothing
""" """
logging.config.dictConfig(log_config or LOGGING_CONFIG_DEFAULTS)
if sock is None: if sock is None:
host, port = host or "127.0.0.1", port or 8000 host, port = host or "127.0.0.1", port or 8000
@ -632,13 +631,12 @@ class Sanic:
async def create_server(self, host=None, port=None, debug=False, async def create_server(self, host=None, port=None, debug=False,
ssl=None, sock=None, protocol=None, ssl=None, sock=None, protocol=None,
backlog=100, stop_event=None, backlog=100, stop_event=None,
access_log=True, log_config=None): access_log=True):
"""Asynchronous version of `run`. """Asynchronous version of `run`.
NOTE: This does not support multiprocessing and is not the preferred NOTE: This does not support multiprocessing and is not the preferred
way to run a Sanic application. way to run a Sanic application.
""" """
logging.config.dictConfig(log_config or LOGGING_CONFIG_DEFAULTS)
if sock is None: if sock is None:
host, port = host or "127.0.0.1", port or 8000 host, port = host or "127.0.0.1", port or 8000

View File

@ -1,4 +1,5 @@
import logging import logging
import sys
LOGGING_CONFIG_DEFAULTS = dict( LOGGING_CONFIG_DEFAULTS = dict(
@ -28,17 +29,17 @@ LOGGING_CONFIG_DEFAULTS = dict(
"console": { "console": {
"class": "logging.StreamHandler", "class": "logging.StreamHandler",
"formatter": "generic", "formatter": "generic",
"stream": "sys.stdout" "stream": sys.stdout
}, },
"error_console": { "error_console": {
"class": "logging.StreamHandler", "class": "logging.StreamHandler",
"formatter": "generic", "formatter": "generic",
"stream": "sys.stderr" "stream": sys.stderr
}, },
"access_console": { "access_console": {
"class": "logging.StreamHandler", "class": "logging.StreamHandler",
"formatter": "access", "formatter": "access",
"stream": "sys.stdout" "stream": sys.stdout
}, },
}, },
formatters={ formatters={