Skip to content

Conversation

@ObadaS
Copy link
Collaborator

@ObadaS ObadaS commented Oct 8, 2025

A brief description of the purpose of the changes contained in this PR.

Changed default logger to Loguru

Made Loguru intercept all logs and colorize them.

Also added an easier way to change logs to DEBUG INFO WARNING etc from the .env file, and made it possible to generate JSON logs with Loguru

The Gunicorn/Uvicorn interception was based on this guide, which I adapted a bit.

I added some new options in the .env file, so a manual intervention is needed to update the local .env file. The default value for those options is INFO and false, so if they don't exist in the .env file, the instance won't have any problems.

# -----------------------------------------------------------------------------
# Logging (Serialized outputs the logs in JSON format)
# -----------------------------------------------------------------------------
LOG_LEVEL=info
SERIALIZED=false

Some images:

Compute worker logs :

Old

image image

New

image image

Django

Old

image

New

image

Site worker:

Old

image

New

image

An error from the site worker, uploading a submission as a competition bundle

Old

image

New

image

And to finish, one screenshot of logs converted to JSON (from the site worker)

image

Checklist

  • Code review by me
  • Hand tested by me
  • I'm proud of my work
  • Code review by reviewer
  • Hand tested by reviewer
  • CircleCi tests are passing
  • Ready to merge

Obada Haddad added 10 commits October 8, 2025 11:59
@ObadaS ObadaS changed the title Changed default logger to Loguru; Made Loguru intercept all logs and colorize them. Also added an easier way to change logs to DEBUG INFO WARNING etc from the .env file, and made it possible to generate JSON logs with Loguru Changed logger to Loguru Oct 10, 2025
@ObadaS ObadaS assigned wlln and unassigned wlln Oct 10, 2025
@ObadaS ObadaS requested a review from wlln October 10, 2025 08:58
@ObadaS ObadaS merged commit 4160992 into develop Oct 10, 2025
1 check passed
@Didayolo Didayolo deleted the logColors branch October 10, 2025 10:49
@Didayolo
Copy link
Member

That is a very good change, thank you.

I think this is a related issue:

Let's see if it's a change we want too.

@ObadaS
Copy link
Collaborator Author

ObadaS commented Oct 10, 2025

I will look at Loguru's options to see if it can make some arguments more readable

@Didayolo
Copy link
Member

I will look at Loguru's options to see if it can make some arguments more readable

Nice. Otherwise, we can also take inspiration from this fork where this was done:

https://github.com/utkutvskin/codabench/pull/1/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants