tracing_proc_macros_rs

Crates.iotracing_proc_macros_rs
lib.rstracing_proc_macros_rs
version
sourcesrc
created_at2024-12-12 13:38:50.728805
updated_at2024-12-12 13:38:50.728805
descriptionProvides `tracing` integration for the `rustc` compilers `proc_macro` crate.
homepagehttps://github.com/ink-feather-org/tracing_proc_macros_rs
repositoryhttps://github.com/ink-feather-org/tracing_proc_macros_rs
max_upload_size
id1481274
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`
size0
(raldone01)

documentation

README

tracing_proc_macro_rs

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.

Requirements

This crate requires a nightly compiler.

Usage

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.

Example

Check out the example crate example_proc_macro.

How to turn on logging?

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

How to speed up the compilation?

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.

Custom Logger setup

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.

License

This project is released under either:

at your choosing.

Contribution

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.

Links

tracing

tracing-subscriber

Commit count: 0

cargo fmt