Add docs for logging of queries. (#1350)

This commit is contained in:
Eric Huss 2022-05-11 21:56:26 -07:00 committed by GitHub
parent 0c88f29374
commit cb69a95ade
1 changed files with 24 additions and 0 deletions

View File

@ -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 calls. This helps you in looking through the calls that are happening and helps you adjust
your regex if you mistyped it. 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 ## Broad module level filters
You can also use filters similar to the `log` crate's filters, which will enable You can also use filters similar to the `log` crate's filters, which will enable