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

refactor(zfctl): improve logs #266

Merged
merged 1 commit into from
Jan 29, 2025
Merged

refactor(zfctl): improve logs #266

merged 1 commit into from
Jan 29, 2025

Conversation

J-Loudet
Copy link
Contributor

This commit brings some improvements to the outputted logs when launching zfctl and the zfctl daemon command.

The most notable additions are:

  • when starting a Zenoh-Flow Daemon, its name and Zenoh ID will be logged,
  • the RUST_LOG environment variable will be used if specified,
  • the default logging level was set to zfctl=info,zenoh_flow=info.
  • zfctl/src/daemon_command.rs:
    • Added a span at the top of the run method to be used within the async block.
    • Reworked the code to not panic! when an error occurred but instead return it and/or add logs.
  • zfctl/src/instance_command.rs:
    • Properly display the id of the newly created instance.
    • Display a command to check for the status of a newly created instance.
  • zfctl/src/main.rs:
    • Read the environment variable RUST_LOG to control the logs.
    • Set the default logging to zfctl=info,zenoh_flow=info.
    • Instrument the async block using a span.
  • zfctl/src/run_local_command.rs:
    • Reworked the code to not panic when an error occurred but instead return it and/or add logs.
  • zfctl/src/utils.rs:
    • Reworked the code to not panic when an error occurred but instead return it and/or add logs.

This commit brings some improvements to the outputted logs when
launching `zfctl` and the `zfctl daemon` command.

The most notable additions are:
- when starting a Zenoh-Flow Daemon, its name and Zenoh ID will be
  logged,
- the `RUST_LOG` environment variable will be used if specified,
- the default logging level was set to `zfctl=info,zenoh_flow=info`.

* zfctl/src/daemon_command.rs:
  - Added a `span` at the top of the `run` method to be used within the
    `async` block.
  - Reworked the code to not `panic!` when an error occurred but instead
    return it and/or add logs.
* zfctl/src/instance_command.rs:
  - Properly display the id of the newly created instance.
  - Display a command to check for the status of a newly created
    instance.
* zfctl/src/main.rs:
  - Read the environment variable RUST_LOG to control the logs.
  - Set the default logging to `zfctl=info,zenoh_flow=info`.
  - Instrument the async block using a span.
* zfctl/src/run_local_command.rs:
  - Reworked the code to not panic when an error occurred but instead
    return it and/or add logs.
* zfctl/src/utils.rs:
  - Reworked the code to not panic when an error occurred but instead
    return it and/or add logs.

Signed-off-by: Julien Loudet <[email protected]>
@J-Loudet J-Loudet force-pushed the refactor/zfctl/improve-logs branch from 10b8203 to 70e59df Compare January 28, 2025 15:44
@J-Loudet J-Loudet merged commit 22b74b3 into main Jan 29, 2025
9 checks passed
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