Skip to content
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

Add a feature flag for logging #5

Open
BSFishy opened this issue Apr 15, 2022 · 4 comments
Open

Add a feature flag for logging #5

BSFishy opened this issue Apr 15, 2022 · 4 comments

Comments

@BSFishy
Copy link

BSFishy commented Apr 15, 2022

I think it would be better to put log statements under a feature flag. Otherwise logs could get filled with extra stuff, or difficult log filtering would need to be implemented. I think it could sometimes be nice to have logs from this crate, however I think dependents should have the option to disable them.

@veeenu
Copy link
Owner

veeenu commented Apr 16, 2022

That's a great idea, thank you. General refactoring is already planned for a new minor release sometime in the near future, so this could very well be part of that.

@veeenu veeenu added this to the 0.3.0 milestone Nov 5, 2022
@veeenu
Copy link
Owner

veeenu commented Nov 5, 2022

The solution to this issue will be implemented like the rocket crate: by defining feature-flagged macros that reexport the existing macros from log if the feature is active, and do nothing otherwise.

@veeenu
Copy link
Owner

veeenu commented Dec 3, 2022

Decided to postpone this too for a later release because the implementation resulted quite tricky and I don't want to invest too much energy on it right now.

I leave a sketch of a possible solution here. It doesn't compile, tries to cloak the macros but it results in some weird scoping issues. I'd consider an alternative solution, if possible.

@veeenu veeenu removed this from the 0.3.0 milestone Dec 3, 2022
@veeenu
Copy link
Owner

veeenu commented May 20, 2023

Now that we have tracing, this might not be necessary and in fact could be dealt with by just setting up the subscribers.

@Jakobzs, you have worked on tracing, do you know how these two could be achieved and if my hypotheses are correct?

  • Completely suppress logging (hypothesis: if you just don't depend on tracing-subscriber in your client, you don't pay any of the runtime cost of having tracing macros?)
  • Filtering out all messages coming from hudhook (do some filtering when setting up tracing-subscriber on the client -- do you have a snippet of what this could look like?)

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

No branches or pull requests

2 participants