Replace root logger calls with module-specific loggers

This commit is contained in:
Ian Renton
2026-08-15 08:35:06 +01:00
parent 74bcd9cded
commit dd89ff4af7
64 changed files with 328 additions and 216 deletions
+7 -5
View File
@@ -34,6 +34,8 @@ from server.handlers.metrics import PrometheusMetricsHandler
from server.handlers.pagetemplate import PageTemplateHandler
from server.sse_broadcaster import SSEBroadcaster
logger = logging.getLogger(__name__)
_HERE = os.path.dirname(__file__ or "")
@@ -159,7 +161,7 @@ class WebServer:
# If in API-only mode, serve a basic homepage; in normal mode, serve the usual UI routes
if self._api_only_mode:
logging.info("API-only mode is enabled. Web UI will not be served.")
logger.info("API-only mode is enabled. Web UI will not be served.")
ui_routes = [
(
r"/",
@@ -238,8 +240,8 @@ class WebServer:
debug=False,
)
app.listen(self._port, xheaders=True)
logging.info(f"Web server running on port {WEB_SERVER_PORT!s}")
logging.info(f"You can access your copy of Spothole at {BASE_URL}")
logger.info(f"Web server running on port {WEB_SERVER_PORT!s}")
logger.info(f"You can access your copy of Spothole at {BASE_URL}")
await self._shutdown_event.wait()
@@ -249,9 +251,9 @@ def request_log(handler):
if LOG_WEB_REQUESTS:
if handler.get_status() < 500:
log_method = logging.info
log_method = logger.info
else:
log_method = logging.warning
log_method = logger.warning
request = handler.request
client_ip = request.remote_ip