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
That's going on to be a crazy dream rather than specific issue, but nonetheless ...
I personally use eprintln rather than log::debug for debugging. log::debug seems like a better thing in theory (because you can reuse the same high-quality logs between different debugging sessions, and you don't need to recompile), but in practice launching code with logging enabled can be hard, and you typically get way more logging output than you need, even if you use filters.
Ideally, you'd just narrow-down logging to a single log statement, but that makes it even harder to set the relevant RUST_LOG env var.
I think this is a case where an IDE can be of great help! I imagine a feature, similar to debugger breakpoints in a graphical debugger, where you can enabled and disable log statements in the IDE on a case by case basis.
Specifically, an IDE maintains a list of active log statements, and, when the cursor is on the log::debug! call, the IDE offers an action to add/remove this particular statement from the set. When a user launches a test or a binary from withing IDE, IDE, known all active log statements, their positions and paths, construct an RUST_LOG env var, which enables only those selected log statements.
However, I think it's currently not possible to use such fine-grained filtering on the env_logger side. Specifically, I can only filter by module prefix, and by regex for all modules. What I need is either:
ability to filter by line number for each module
ability to filter by regex for each module
Additionally, matching on precis module path, and not prefix, would help as well.
I am not sure if it's worth pursuing this, and if I really have time right now to implement this on the rust-analyzer's side, but I thought that it might be good to log the issue anyway :)
The text was updated successfully, but these errors were encountered:
That's going on to be a crazy dream rather than specific issue, but nonetheless ...
I personally use
eprintln
rather thanlog::debug
for debugging.log::debug
seems like a better thing in theory (because you can reuse the same high-quality logs between different debugging sessions, and you don't need to recompile), but in practice launching code with logging enabled can be hard, and you typically get way more logging output than you need, even if you use filters.Ideally, you'd just narrow-down logging to a single log statement, but that makes it even harder to set the relevant
RUST_LOG
env var.I think this is a case where an IDE can be of great help! I imagine a feature, similar to debugger breakpoints in a graphical debugger, where you can enabled and disable log statements in the IDE on a case by case basis.
Specifically, an IDE maintains a list of active log statements, and, when the cursor is on the
log::debug!
call, the IDE offers an action to add/remove this particular statement from the set. When a user launches a test or a binary from withing IDE, IDE, known all active log statements, their positions and paths, construct anRUST_LOG
env var, which enables only those selected log statements.However, I think it's currently not possible to use such fine-grained filtering on the env_logger side. Specifically, I can only filter by module prefix, and by regex for all modules. What I need is either:
Additionally, matching on precis module path, and not prefix, would help as well.
I am not sure if it's worth pursuing this, and if I really have time right now to implement this on the rust-analyzer's side, but I thought that it might be good to log the issue anyway :)
The text was updated successfully, but these errors were encountered: