Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging improvements #560

Merged
merged 10 commits into from
Jan 28, 2025

Conversation

geekingfrog
Copy link
Contributor

@geekingfrog geekingfrog commented Jan 24, 2025

A few improvements to the logging facilities.

in the console when running the dev version we get things like:

2025-01-24 08:32:14.955 [info] user_id=43  Player disconnected abruptly
2025-01-24 08:32:16.956 [debug] user_id=43  Player timed out, stopping session
2025-01-24 08:32:16.956 [debug] queue_id=1v1  Player 43 went down, removing from queue 1v1

and in the log files we get for example:

08:32:13.133 [info] request_id=GB2Ty2vr-qB_ATUAAABE  GET /tachyon
08:32:14.955 [info] user_id=43  Player disconnected abruptly

I did test that on a release build but it's probably better to have a quick look at how the logs look on the integration server to double check things are all working fine.

This gets rid of the compilation warning "warn logging level is
deprecated"
@geekingfrog geekingfrog force-pushed the logging-improvements branch 2 times, most recently from b1ce1c0 to 369ed41 Compare January 24, 2025 09:10
@geekingfrog geekingfrog marked this pull request as ready for review January 24, 2025 09:33
Copy link
Collaborator

@L-e-x-o-n L-e-x-o-n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logging itself seems to work on integration server, but the new configs in runtime.exs are replacing the old ones and creating new logs at a new location.

config/runtime.exs Show resolved Hide resolved
https://hexdocs.pm/logger/main/Logger.html#module-backends-and-backwards-compatibility
the api for custom logging has changed in elixir 1.15 to instead use the
logger_backend project.

Also centralise the logging config. Logger definition and base config
done at compile time in config/config.exs and runtime or env specific
overrides done in config/<env>.exs or config/runtime.exs
With LoggerBackends.Console configured we don't need the default one
anymore, which would duplicate all logs sent to the console
We get logs like:
2025-01-24 08:28:16.231 [debug] queue_id=1v1  Player 43 went down, removing from queue 1v1
Don't use `:all` because this logs way too much, things like file, line,
erl_level and so on.
Maybe later if we go structured log
Not sure if that'a what we want but this keeps the same config as before
the logging changes.
Not sure why it's not there. Since the file name don't have date on
them, it's better to at least have the date there.
@L-e-x-o-n L-e-x-o-n merged commit 28b37d8 into beyond-all-reason:master Jan 28, 2025
3 checks passed
@geekingfrog geekingfrog deleted the logging-improvements branch January 28, 2025 20:15
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.

2 participants