Skip to content

Commit

Permalink
fixup! Issue #195 add log level to log responses
Browse files Browse the repository at this point in the history
  • Loading branch information
soxofaan committed Jan 31, 2025
1 parent 29e1f65 commit ef761a3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions openeo_driver/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,7 @@ class JOB_STATUS:
]


# Default value for `level` parameter in `POST /result`, `POST /jobs`, ... requests
DEFAULT_LOG_LEVEL_PROCESSING = "info"
# Default value for `level in `GET /jobs/{job_id}/logs`, `GET /services/{service_id}/logs` requests
DEFAULT_LOG_LEVEL_RETRIEVAL = "debug"
2 changes: 1 addition & 1 deletion openeo_driver/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1531,7 +1531,7 @@ def get_job_logs(job_id, user: User):

def generate():
yield "{"
yield f'"level": {level!r},'
yield f'"level": {json.dumps(level)}",'
yield '"logs":['

sep = ""
Expand Down
1 change: 1 addition & 0 deletions tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3055,6 +3055,7 @@ def test_get_batch_job_logs(self, api):
with self._fresh_job_registry():
resp = api.get('/jobs/07024ee9-7847-4b8a-b260-6c879a2b3cdc/logs', headers=self.AUTH_HEADER)
assert resp.assert_status_code(200).json == {
"level": "debug",
"logs": [
{"id": "1", "level": "info", "message": "hello world"}
],
Expand Down

0 comments on commit ef761a3

Please sign in to comment.