aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2024-02-19 04:05:28 +0300
committerEvgeny Zinoviev <me@ch1p.io>2024-02-19 04:05:28 +0300
commit847ee95d12d65472bf4e9d4c7f50d4b8fc1ea92e (patch)
tree7ac46be7a0539d2845aa1e8cbc8a2635740c9d4b
parentaff34d50b7dc1315a1d867266c4608ebea9685ca (diff)
logging fixes
-rw-r--r--include/py/homekit/config/config.py1
-rw-r--r--include/py/homekit/http/http.py3
2 files changed, 3 insertions, 1 deletions
diff --git a/include/py/homekit/config/config.py b/include/py/homekit/config/config.py
index c5cc415..4609ee5 100644
--- a/include/py/homekit/config/config.py
+++ b/include/py/homekit/config/config.py
@@ -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:
diff --git a/include/py/homekit/http/http.py b/include/py/homekit/http/http.py
index a8c7d82..b1d33d3 100644
--- a/include/py/homekit/http/http.py
+++ b/include/py/homekit/http/http.py
@@ -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)