diff --git a/src/tracing.md b/src/tracing.md index 63d68e541..0bba73f74 100644 --- a/src/tracing.md +++ b/src/tracing.md @@ -60,6 +60,30 @@ still get a short message per ignored `do_mir_borrowck`, but none of the things calls. This helps you in looking through the calls that are happening and helps you adjust your regex if you mistyped it. +## Query level filters + +Every [query](query.md) is automatically tagged with a logging span so that +you can display all log messages during the execution of the query. For +example, if you want to log everything during type checking: + +``` +RUSTC_LOG=[typeck] +``` + +The query arguments are included as a tracing field which means that you can +filter on the debug display of the arguments. For example, the `typeck` query +has an argument `key: LocalDefId` of what is being checked. You can use a +regex to match on that `LocalDefId` to log type checking for a specific +function: + +``` +RUSTC_LOG=[typeck{key=.*name_of_item.*}] +``` + +Different queries have different arguments. You can find a list of queries and +their arguments in +[`rustc_middle/src/query/mod.rs`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_middle/src/query/mod.rs#L18). + ## Broad module level filters You can also use filters similar to the `log` crate's filters, which will enable