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

RustFest2024 - Logging improvements suggestions #1079

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

DominikStefancik
Copy link

Why? What?

This draft PR contains suggestions on logging improvements discussed with the HULK team during RustFest 2024 in Zurich. It is supposed to serve as an inspiration for using logging in the hulk codebase.

We discussed two possible approaches:

  1. Improve general logging
  2. Use logging for tracing asynchronous communication between different parts of the robot system and debug tools.

Improve general logging

Current logging using fern crate could be enhanced by:

  • using different "types" of logs for different purposes
  • specifying logs with the target attribute and name of the crate (see changes in the path_planner.rs)
  • define a separate config for these logs as well as their output (stdout, file, ...), (see change in the setup_logger function)

Use logging for tracing asynchronous communication

The idea is to use crate tracing for emitting log spans on one side and creating subscribers to these log on the other side.

For this you need to:

  • add crates tracing and tracing-subscriber
  • create a default or custom subscriber + define its configuration (see the changes in the tools/fanta/src/main.rs)
  • emit log spans wherever you want to log details worth logging (see changes in the path_planner.rs)

Sources

Fern setup: example
Tracing used in Tokio: page

Possible next steps:

Create custom subscribers for a particular purpose: documentation
Use tokio-console for more logging, integrate with telemetry: documentation

@DominikStefancik DominikStefancik marked this pull request as draft June 24, 2024 12:03
@DominikStefancik DominikStefancik changed the title Rustfest2024 - Logging improvements suggestions RustFest2024 - Logging improvements suggestions Jun 24, 2024
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.

1 participant