Crates.io | tracing_proc_macros_rs |
lib.rs | tracing_proc_macros_rs |
version | |
source | src |
created_at | 2024-12-12 13:38:50.728805 |
updated_at | 2024-12-12 13:38:50.728805 |
description | Provides `tracing` integration for the `rustc` compilers `proc_macro` crate. |
homepage | https://github.com/ink-feather-org/tracing_proc_macros_rs |
repository | https://github.com/ink-feather-org/tracing_proc_macros_rs |
max_upload_size | |
id | 1481274 |
Cargo.toml error: | TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
tracing_proc_macro_rs
provides tracing
integration for the rustc
compilers proc_macro
crate.
It only works in proc-macro = true
crates and it is nightly only.
Log records are emitted using nightly compiler diagnostics.
This crate requires a nightly compiler.
Every top level function in your proc_macro
crate should call tracing_proc_macro_rs::proc_macro_logger_default_setup()
to setup the logger for the proc_macro
crate.
After that normal tracing
logging can be used in the proc_macro
crate.
Check out the example crate example_proc_macro
.
By default logging is turned off.
To run it on, you need to set the RUST_LOG
environment variable:
cargo clean -p example_proc_macro
RUST_LOG=trace cargo build --workspace --bins
To remove the logging calls entirely from the proc_macro
crate, you can directly depend on tracing
and enable the features that remove the logging calls.
Providing a customized logging setup is trivial.
Copy the code from tracing_proc_macro_rs::proc_macro_logger_default_setup()
into your own crate and modify it to your needs.
The default default-setup
feature can be disabled with no-default-features = true
to avoid enabling unnecessary tracing-subscriber
features.
This project is released under either:
at your choosing.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.