Document how to use Cargo's internal logging

This commit is contained in:
Aleksey Kladov 2018-04-08 18:28:27 +03:00
parent 681756252b
commit 506786d0f2
2 changed files with 22 additions and 5 deletions

View File

@ -101,5 +101,22 @@ assert_that(
p.cargo("run"),
execs().stream().with_status(0)
);
```
## Logging
Cargo uses [`env_logger`](https://docs.rs/env_logger/*/env_logger/), so you can set
`RUST_LOG` environment variable to get the logs. This is useful both for diagnosing
bugs in stable Cargo and for local development. Cargo also has internal hierarchical
profiling infrastructure, which is activated via `CARGO_PROFILE` variable
```
# Outputs all logs with levels debug and higher
$ RUST_LOG=debug cargo generate-lockfile
# Don't forget that you can filter by module as well
$ RUST_LOG=cargo::core::resolver=trace cargo generate-lockfile
# Output first three levels of profiling info
$ CARGO_PROFILE=3 cargo generate-lockfile
```

View File

@ -22,10 +22,9 @@ and unexpected behavior.
its users' security, please do not open a public issue on GitHub. Instead,
we ask you to refer to Rust's [security policy].**
Opening an issue is as easy as following [this
link][new-issues] and filling out the fields.
Here's a template that you can use to file an issue, though it's not necessary to
use it exactly:
Opening an issue is as easy as following [this link][new-issues] and filling out
the fields. Here's a template that you can use to file an issue, though it's not
necessary to use it exactly:
<short summary of the problem>
@ -42,7 +41,8 @@ happened instead. Please use https://gist.github.com/ if your examples run long.
## Working on issues
If you're looking for somewhere to start, check out the [E-easy][E-Easy] tag.
If you're looking for somewhere to start, check out the [E-easy][E-Easy] and
[E-mentor][E-mentor] tags.
Feel free to ask for guidelines on how to tackle a problem on [IRC] or open a
[new issue][new-issues]. This is especially important if you want to add new