Skip to content

Commit 0df7a5e

Browse files
authored
Better debugging (#410)
* refactor: add status_code to debug response message * build: allow for LOG_LEVEL overwrite
1 parent 27f3028 commit 0df7a5e

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ x-application-service: &application-service
1111
DJANGO_SETTINGS_MODULE: qsts3.settings
1212
DJANGO_SECRET_KEY: ${DJANGO_SECRET_KEY:-django-insecure-2ir3a7tRpdDNBdymZYdmvQ61Qv1gJF9CyUoxkZcQHqg}
1313
QSTS_DEBUG: ${QSTS_DEBUG:-True}
14+
LOG_LEVEL: ${LOG_LEVEL:-}
1415
DB_NAME: ${DB_NAME:-quickstatements}
1516
DB_USER: ${DB_USER:-root}
1617
DB_PASSWORD: ${DB_PASSWORD:-quickstatements_pass}

src/core/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def wikibase_request_wrapper(self, method, endpoint, body):
198198

199199
res = getattr(self.session, method.lower())(url, **kwargs)
200200

201-
logger.debug(f"{method} request at {url} | response: {res.json()}")
201+
logger.debug(f"{method} request at {url} | response ({res.status_code}): {res.json()}")
202202
self.raise_for_status(res)
203203
return res.json()
204204

src/qsts3/settings.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@
152152

153153

154154
LOG_LEVEL = "DEBUG" if DEBUG else "INFO"
155+
156+
if os.getenv("LOG_LEVEL"):
157+
LOG_LEVEL = os.getenv("LOG_LEVEL").upper()
158+
155159
APP_LOG_CONFIG = {
156160
"handlers": ["console"],
157161
"level": LOG_LEVEL,

0 commit comments

Comments
 (0)