Comments (5)
👋 Dropping a line here in reference to a convo in the #tracing channel in Discord.
Currently we use slog
in a bunch of our libs/services which has a syntax like
info!(logger, "msg: {}", 1, formatted_field="a"; "additional_field" => 4)
The fields before the ; are used for the format string, and the result of that is used as msg
in the json output. The fields after are just added to the json directly.
I'm not actually a huge fan of this, mostly cause it leads to duplication of fields, and the syntax differs between then in a weird wait. Something that might be nice could be if the syntax was basically just like format!/println!
but it didn't error when named arguments weren't used, and all named arguments were added as fields, but I haven't totally thought through the implications of that. Like I'm not sure how field = ?value
would work if the field was used multiple times, and say we wanted it to be Display in the span/event fields, but Debug in the message
from tracing.
I suspect it should be possible to add syntax for interpolating fields into a textual message in tokio-trace
's current macros. May just require some thought to make work.
from tracing.
Since Rust RFC 2795 will be stabilized in 1.58, the ergonomic semantics outlined by @samschlegel above should soon be achievable. All we'll need to do is modify event!
and span!
to interpret format arguments as fields, and use implicit format argument captures for them so that unused fields do not become an error.
from tracing.
Is there anything currently blocking this feature from happening?
from tracing.
No, it's fairly straightforwardly doable now, just nobody's had time to get to it.
from tracing.
Related Issues (20)
- Unqualified `line!` macro usage inside `info!` causes issues with `ratatui_macros` HOT 1
- How to modify EnvFilter instead of replace HOT 3
- RollingFileAppender `prune_old_logs()` relies on `metadata().created()` which is not available on all platforms HOT 1
- Make Layer::with_writer not truncate the file HOT 4
- When will the feature(`valuable` suport`) be merged into stable version? HOT 1
- error[E0609]: no field `free` on type `REGISTRY` HOT 3
- Add an option for outputting span IDs HOT 1
- RollingFileAppender: prefix and suffix custom separator
- `#instrument` attribute not making new spans HOT 2
- Execute custom code every time `error!` (etc) is called HOT 4
- Make path clickable HOT 2
- Lacking documentation of context propagation through channels HOT 2
- `fn subscriber` did exist in the main branch, but not in `tracing-subscriber-0.3.18` HOT 2
- Valuable: Enum Representations
- JSON: Field names should account for `r#` HOT 4
- Inconsistent behaviour in tracing_subscriber wrt tracing_log HOT 7
- Allow `Display` formatting of `Option`s in messages HOT 2
- `warn!` inside `unwrap_or(..)` argument body HOT 2
- Filter to detect/exclude events sourced from the `log` crate via `tracing-log` HOT 1
- Incorrect Documentation for `tracing_appender::rolling::daily`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tracing.