Closed amab8901 closed 1 month ago
Another alternative would be to use a debugger if you need to know whether you're hitting each line.
Anyway, I don't think macros can even be used like this, the line
macro would just print the line ofnthe attribute itself as documented.
Yeah, as @mladedav said, you're better off using a debugger here. tracing
's is meant to be used as an intentional, human-directed "something happened here"-esque tool.
Feature Request
Motivation
I often encounter the situation where there's a bug and I'm not sure where the bug is coming from. This proposed feature would save me lots of time since it would let me apply and cleanup these bughunting logs more quickly by doing it via a function attribute instead of manually having to write it for each line.
Proposal
This attribute:
Is shorthand for this:
(and similar for the other log levels)
This lets the user add and remove those log lines more quickly to debug their program more quickly. A drawback may be a slightly steeper learning curve for people who haven't used the tracing crate before.
Alternatives
Writing
warn!()
manually, as well asprintln!
,dbg!
. These approaches work, but they are tedious relative to the suggested feature