logging fixes

This commit is contained in:
Evgeny Zinoviev 2024-02-19 04:05:28 +03:00
parent aff34d50b7
commit 847ee95d12
2 changed files with 3 additions and 1 deletions

View File

@ -54,7 +54,6 @@ class BaseConfigUnit(ABC):
return key in self._data
def load_from(self, path: str):
print(f'loading config from {path}')
with open(path, 'r') as fd:
self._data = yaml.safe_load(fd)
if self._data is None:

View File

@ -7,6 +7,7 @@ from aiohttp import web
from aiohttp.web import HTTPFound
from aiohttp.web_exceptions import HTTPNotFound
from ..util import stringify, format_tb, Addr
from ..config import is_development_mode
_logger = logging.getLogger(__name__)
@ -67,6 +68,8 @@ async def errors_handler_middleware(request, handler):
def serve(addr: Addr, before_start=None, handle_signals=True, routes=None, event_loop=None):
logging.getLogger('aiohttp').setLevel(logging.DEBUG if is_development_mode() else logging.WARNING)
app = web.Application()
app.middlewares.append(errors_handler_middleware)