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

feat(iroh-cli): add file logging by default for start commands #2175

Merged
merged 24 commits into from
Apr 12, 2024

Conversation

divagant-martian
Copy link
Contributor

@divagant-martian divagant-martian commented Apr 11, 2024

Description

Adds file logging by default to commands that start a node.

Parameters are:

  • the "RUST_LOG" directive, in the form of and env var IROH_FILE_RUST_LOG or in the configuration file.
  • rotation: how often a new file is created. Either daily, hourly or never.
  • max files: Maximum number of files to keep

File logging can be disabled by either setting the max_files to 0 in the configuration file or by setting the rust log statement to off, in either the env var or the config file.

(example config file)

[file_logs]
rust_log = "iroh=trace"
rotation = "daily"
max_files = 1

The files created live the IROH_DATA_DIR/logs dir and are named iroh-2024-03-02.log (for a daily rotation, or with the hour, for an hourly rotation)

By default, we log everything in debug, rotating hourly, keeping at most 4 files (so total 4 hours of logs). This is short default since debug logs, even in an idle node, are a lot

Notes & open questions

n/a

Change checklist

  • Self-review.
  • Documentation updates if relevant.
  • Tests if relevant.

@divagant-martian divagant-martian marked this pull request as ready for review April 11, 2024 21:39
@divagant-martian divagant-martian changed the title [wip] File logging feat(iroh-cli): add file logging by default for start commands Apr 11, 2024
@divagant-martian divagant-martian self-assigned this Apr 11, 2024
@divagant-martian divagant-martian linked an issue Apr 11, 2024 that may be closed by this pull request
iroh-cli/Cargo.toml Outdated Show resolved Hide resolved
iroh-cli/src/logging.rs Outdated Show resolved Hide resolved
iroh-cli/src/logging.rs Outdated Show resolved Hide resolved
iroh-cli/src/logging.rs Show resolved Hide resolved
iroh-cli/src/commands.rs Outdated Show resolved Hide resolved
divagant-martian and others added 2 commits April 12, 2024 09:33
Co-authored-by: Floris Bruynooghe <flub@devork.be>
@ramfox ramfox added this to the v0.14.0 milestone Apr 12, 2024
Copy link
Contributor

@flub flub left a comment

Choose a reason for hiding this comment

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

nice!

@divagant-martian divagant-martian added this pull request to the merge queue Apr 12, 2024
Merged via the queue into n0-computer:main with commit b80b338 Apr 12, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add file logger
3 participants