diff --git a/sanic/app.py b/sanic/app.py index 63700e9d..4211eb1d 100644 --- a/sanic/app.py +++ b/sanic/app.py @@ -12,7 +12,6 @@ from sanic.config import Config from sanic.constants import HTTP_METHODS from sanic.exceptions import ServerError, URLBuildError, SanicException from sanic.handlers import ErrorHandler -from sanic.log import log from sanic.response import HTTPResponse from sanic.router import Router from sanic.server import serve, serve_multiple, HttpProtocol @@ -21,6 +20,9 @@ from sanic.testing import TestClient from sanic.views import CompositionView +log = logging.getLogger(__name__) + + class Sanic: def __init__(self, name=None, router=None, error_handler=None): diff --git a/sanic/handlers.py b/sanic/handlers.py index d5a5d0dd..40888caa 100644 --- a/sanic/handlers.py +++ b/sanic/handlers.py @@ -1,4 +1,5 @@ import sys +import logging from traceback import format_exc, extract_tb from sanic.exceptions import ( @@ -10,9 +11,10 @@ from sanic.exceptions import ( TRACEBACK_LINE_HTML, TRACEBACK_STYLE, TRACEBACK_WRAPPER_HTML) -from sanic.log import log from sanic.response import text, html +log = logging.getLogger(__name__) + class ErrorHandler: handlers = None diff --git a/sanic/request.py b/sanic/request.py index bca0cf27..cc78ec92 100644 --- a/sanic/request.py +++ b/sanic/request.py @@ -1,3 +1,4 @@ +import logging from cgi import parse_header from collections import namedtuple from http.cookies import SimpleCookie @@ -10,9 +11,9 @@ except ImportError: from json import loads as json_loads from sanic.exceptions import InvalidUsage -from sanic.log import log +log = logging.getLogger(__name__) DEFAULT_HTTP_CONTENT_TYPE = "application/octet-stream" # HTTP/1.1: https://www.w3.org/Protocols/rfc2616/rfc2616-sec7.html#sec7.2.1 # > If the media type remains unknown, the recipient SHOULD treat it diff --git a/sanic/server.py b/sanic/server.py index 83bda3fc..c15cbc94 100644 --- a/sanic/server.py +++ b/sanic/server.py @@ -1,5 +1,6 @@ import asyncio import os +import logging import traceback import warnings from functools import partial @@ -19,11 +20,11 @@ try: except ImportError: async_loop = asyncio -from sanic.log import log from sanic.request import Request from sanic.exceptions import ( RequestTimeout, PayloadTooLarge, InvalidUsage, ServerError) +log = logging.getLogger(__name__) current_time = None diff --git a/sanic/testing.py b/sanic/testing.py index 387424b0..73eb4376 100644 --- a/sanic/testing.py +++ b/sanic/testing.py @@ -1,5 +1,7 @@ -from sanic.log import log +import logging + +log = logging.getLogger(__name__) HOST = '127.0.0.1' PORT = 42101