-
Notifications
You must be signed in to change notification settings - Fork 498
docs(iroh): improve readme #4329
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6c7e2e3
docs(iroh): improve readme
Frando 7b1033d
Merge branch 'main' into Frando/readme
Frando b00b914
more improvements
Frando 9c21527
Merge remote-tracking branch 'origin/main' into Frando/readme
Frando 4037e92
fixup
Frando fd73735
fixes for main readme
Frando 64fed3b
Merge branch 'main' into Frando/readme
Frando 431781f
Merge branch 'main' into Frando/readme
Frando f71dbaa
Merge branch 'main' into Frando/readme
Frando File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # Developing iroh | ||
|
|
||
| ## Structured events | ||
|
|
||
| The library uses [tracing] both for logging and for *structured events*. | ||
| Events differ from normal logging by convention: | ||
|
|
||
| - The [target] is prefixed with `iroh::_events::`, with `::`-separated names. | ||
| - There is **no message**; the unique target indicates the meaning. | ||
| - The [fields] carry exclusively structured data. | ||
| - The [Level] is always `DEBUG`. | ||
|
|
||
| This lets automated tooling process events through custom subscribers while | ||
| still producing distinct output under the default tracing formatters, and makes | ||
| them unlikely to conflict with real modules. | ||
|
|
||
| An application can subscribe to the `iroh::_events` target separately. With the | ||
| default file logging it is also easy to grep for all events: | ||
|
|
||
| ```sh | ||
| rg 'events::[a-z_\-:]+' path/to/iroh/logs/iroh.YYYY-MM-DD-NN.log | ||
| ``` | ||
|
|
||
| When adding events, aim for a high signal-to-noise ratio and design them to be | ||
| extracted automatically. To keep them distinct from normal logging, write them | ||
| with the `event!()` macro: | ||
|
|
||
| ```rust,ignore | ||
| event!( | ||
| target: "iroh::_events::subject", | ||
| Level::DEBUG, | ||
| field = value, | ||
| ); | ||
| ``` | ||
|
|
||
| ## Building documentation | ||
|
|
||
| Building the documentation is only supported with `--all-features`. To also | ||
| document the cargo features required for certain APIs, pass the `iroh_docsrs` | ||
| cfg to rustdoc, which requires nightly Rust: | ||
|
|
||
| ```sh | ||
| RUSTDOCFLAGS="--cfg iroh_docsrs" cargo +nightly doc --workspace --no-deps --all-features | ||
| ``` | ||
|
|
||
| [target]: https://docs.rs/tracing/latest/tracing/struct.Metadata.html#method.target | ||
| [fields]: https://docs.rs/tracing/latest/tracing/#recording-fields | ||
| [Level]: https://docs.rs/tracing/latest/tracing/struct.Level.html | ||
| [tracing]: https://docs.rs/tracing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.