Skip to content

Commit

Permalink
feat(iroh-cli): add file logging by default for start commands (#2175)
Browse files Browse the repository at this point in the history
## 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)
```toml
[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

- [x] Self-review.
- [x] Documentation updates if relevant.
- [ ] Tests if relevant.

---------

Co-authored-by: Floris Bruynooghe <[email protected]>
  • Loading branch information
divagant-martian and flub authored Apr 12, 2024
1 parent 9f46eff commit eb44ed9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit eb44ed9

Please sign in to comment.