Add JSON logger
All checks were successful
continuous-integration/drone Build is passing

This commit is contained in:
Lauri Võsandi 2022-07-11 13:28:22 +03:00
parent aa6598ee68
commit 85c9adfe74
2 changed files with 3 additions and 0 deletions

View File

@ -18,6 +18,7 @@ RUN apt-get update \
motor \ motor \
prometheus_client \ prometheus_client \
sanic==21.6.2 \ sanic==21.6.2 \
sanic-json-logging \
git+https://github.com/Assarius/sanic-prometheus@Sanic_22 \ git+https://github.com/Assarius/sanic-prometheus@Sanic_22 \
&& apt-get remove -y \ && apt-get remove -y \
build-essential \ build-essential \

View File

@ -18,6 +18,7 @@ from math import inf
from motor.motor_asyncio import AsyncIOMotorClient from motor.motor_asyncio import AsyncIOMotorClient
from prometheus_client import Counter, Gauge, Histogram from prometheus_client import Counter, Gauge, Histogram
from sanic import Sanic, response from sanic import Sanic, response
from sanic_json_logging import setup_json_logging
from sanic.log import logger from sanic.log import logger
from sanic_prometheus import monitor from sanic_prometheus import monitor
from sanic.response import stream from sanic.response import stream
@ -409,6 +410,7 @@ async def downloader(queue: asyncio.Queue):
await asyncio.sleep(1) await asyncio.sleep(1)
app = Sanic("camdetect") app = Sanic("camdetect")
setup_json_logging(app)
@app.route("/bypass") @app.route("/bypass")