-
Notifications
You must be signed in to change notification settings - Fork 3
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
Support shorthand for #[emit::as_debug]
#168
Comments
An alternative design here is another macro:
This would make |
Just to add another perspective, for me the main advantage of |
Yeh, the balance I'm trying to strike is that debug is convenient for quick debugging, especially when working with a lot of internal types that don't implement display, but I think is non-ideal for long-term logging. In that case, you're better off with a deliberate and stable format from display, or a structured format from serde. I was hoping a different macro for quick-and-dirty debugging would put you in a different mindset, so your long-lived events would be higher quality. |
The case of logging values with their debug representation while building or testing code is common and important enough that we may want a shorthand for it. Instead of having to write:
you could instead write:
The
ident:?
pattern would expand to#[emit::as_debug] ident
. You wouldn't be able to combine it with other attributes or format flags, and other attributes wouldn't have a shorthand. We may also restrict it to thedebug!
macro. The goal is just to make it easier to pepper temporary debug-style logging in code you're actively working on. Long-term logging should prefer serialized or display-formatted values over the debug format.The text was updated successfully, but these errors were encountered: