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

Use "yaserde_derive" as the log target for generated logging calls #120

Merged
merged 2 commits into from Dec 1, 2021

Conversation

Felerius
Copy link
Contributor

This fixes #16 by allowing users to filter out the log messages. For example,

RUST_LOG="debug,yaserde_derive=off" cargo test -- --nocapture

works as expected now. After upgrading to env_logger 0.9, it even shows yaserde_derive instead of the module path in the logging messages (due to rust-cli/env_logger#209):

...
[2021-07-24T10:24:33Z DEBUG yaserde_derive] Struct Data @ 0: start to parse "data"
...

To avoid specifying target: "yaserde_derive" in every logging call, I created custom __derive_debug and __derive_trace macros in the main crate. However, they could just as well be inlined. Lastly, I hid the re-exported xml and log crates from docs and prefixed them with __ to indicate that they're not considered public api.

@Felerius
Copy link
Contributor Author

I just realized that renaming the xml and log re-exports is technically a breaking change since they might be used outside of yaserde_derive. If you don't want that then, they could instead be made doc(hidden) without renaming them.

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.

log output not tagged with 'yaserde'?
2 participants