Skip to content
New issue

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

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

Already on GitHub? # to your account

Improve logging and API of the config module #1133

Merged
merged 7 commits into from
Dec 17, 2024

Conversation

llucax
Copy link
Contributor

@llucax llucax commented Dec 17, 2024

  • Log the full actor name when restarting
  • Improve logging for configuration file reading
  • Make load_config keyword arguments keyword-only
  • Make arguments passed to marshmallow explicit
  • Document and fix how to implement custom stopping logic
  • Enabled INFO logging by default
  • Change debug logs to info

The actor `name` is really just a unique ID, and lacks the class name.
For logging is best to use the `str`, which includes both the class name
and the ID.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
@llucax llucax requested a review from a team as a code owner December 17, 2024 10:51
@llucax llucax requested review from ela-kotulska-frequenz and removed request for a team December 17, 2024 10:51
@llucax llucax self-assigned this Dec 17, 2024
@llucax llucax added this to the v1.0.0-rc1500 milestone Dec 17, 2024
@github-actions github-actions bot added part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests part:actor Affects an actor ot the actors utilities (decorator, etc.) part:config Affects the configuration management labels Dec 17, 2024
@llucax llucax enabled auto-merge December 17, 2024 10:52
Forwarding keyword arguments looks nice but makes the function typing
much weaker. Any typos in the keyword arguments taken by the function
end up undetected until they reach `marshmallow.Schema.load()` and then
they give an obscure error about some unexpected argument that was
never the intention to forward to `marshmallow`.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
The `BackgroundService` should not return early if there are no tasks
in `stop()`, as sub-classes could need to implement a custom stopping
logic. In this case it should be enough to override the `cancel()` and
`wait()` methods, and the `is_running` property.

We also add an example of how this could be done.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
The `LoggingConfig` will now create a default root logger that has
`INFO` enabled and `INFO` is passed to `logging.basicConfig()`, so user
can at least see `INFO` messages during initialization.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Updating loggers config is not that often, and to be able to debug with
some confidence, is good to see exactly which loggers were enabled with
which levels, so we convert logs about configuring the loggers from
debug to info.

Now that we are showing how loggers are being configured, there is no
need to show the whole new configuration, which could be pretty lengthy.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
@llucax llucax added this pull request to the merge queue Dec 17, 2024
Merged via the queue into frequenz-floss:v1.x.x with commit 1f839e4 Dec 17, 2024
18 checks passed
@llucax llucax deleted the config-misc branch December 17, 2024 13:37
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
part:actor Affects an actor ot the actors utilities (decorator, etc.) part:config Affects the configuration management part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests
Projects
Development

Successfully merging this pull request may close these issues.

2 participants