You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The std::dbg!() macro is quite useful for quick debugging. I have stumbled across at least a handful of cases where whatever the logger is is more useful than stderr output - for example, when the logger is mapped to RTT or UART on embedded and there is no stderr available.
So, my suggestion is to add ldbg that acts similarly to the debug macro, but uses the default logger.
use log::{ldbg,Level};let v = vec![0usize, 1, 2, 3, 4];// default to debug level (possibly warn or info so it's more likely to show up)let m = ldbg!(&v[2..]);// allow for optional level overridelet n = ldbg!(level: Level::Warn, &v[..3]);
The text was updated successfully, but these errors were encountered:
On the one hand I see the usefulness of the dbg! macro for quick debugging. However I think these statement shouldn't be committed (i.e. they should be removed before sending the code upstream).
If you need more information in a way that the log crate can provide I think it would be more beneficial to add proper debug! message and use the release_max_level_info (or similar) feature to remove them from release binary. (this will also safe you time the next time you're debugging a similar issue, speaking from experience)
The
std::dbg!()
macro is quite useful for quick debugging. I have stumbled across at least a handful of cases where whatever the logger is is more useful than stderr output - for example, when the logger is mapped to RTT or UART on embedded and there is no stderr available.So, my suggestion is to add
ldbg
that acts similarly to the debug macro, but uses the default logger.The text was updated successfully, but these errors were encountered: