Skip to content

Conversation

@LeoPatOZ
Copy link
Collaborator

@LeoPatOZ LeoPatOZ commented Dec 17, 2025

Towards #52

  • Wrapped all tracing macros behind our internal 'opt_x' macro (optional tracing). These need to have the 'tracing' feature flag enabled to show tracing (Tested this with an external repo and all logs disappear if tracing feature is not enabled)

@0xNeshi You're the macro king. Currently two things are annoying

  1. Because in the 'non tracing' feature flag case the macro expands to unit type (), any var passed in to our macro shows as unused so to please clippy you have to prefix with _ to make it think its not used (as some times it is indeed not used). The solution would be for the 'emtpy' tracing macro to expand into something that accepts an argument then ignores it so its still seen as 'used' but cant get that to work..
                        if let Err(_e) = self.handle_command(command).await {
                            opt_error!("Command handling error: {}", _e);
                            self.error_count += 1;
                        }

Annoyingly some imports are only needed due to a macro leading to unused import warnings as well.

So there are a lot of work arounds (i.e. allow unused import) you'll see other quicks.

This also leads to the used_underscore_binding clippy error... which we have to ignore. As its simultaneously being used and not 🔮

  1. Rust analyser sees macro as 'inactive'

  2. Ideally we even import tracing as optional if tracing feature flag is on or off (slightly reducing our package size)- i think its theoretically possible however not sure how to do it.

@0xNeshi
Copy link
Collaborator

0xNeshi commented Dec 18, 2025

Created new PR addressing the issues and replacing this PR:
#270

Targeted main directly as it's easier to see the changes

Copy link
Collaborator

@0xNeshi 0xNeshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LeoPatOZ
Copy link
Collaborator Author

Nice amazing! way cleaner than mine haha

Happy to close this in favour!

@0xNeshi 0xNeshi closed this Dec 18, 2025
@0xNeshi 0xNeshi deleted the optional-tracing branch December 18, 2025 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants