Skip to content

Commit 3c5289d

Browse files
committed
Auto merge of #5323 - matklad:document-good-stuff, r=alexcrichton
Document how to use Cargo's internal logging I always forget the syntax for filtering by module, and I've learned about `CARGO_PROFILE` yesterday, so let's document these for other contributors as well :-)
2 parents 0d49d57 + 506786d commit 3c5289d

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

ARCHITECTURE.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,5 +101,22 @@ assert_that(
101101
p.cargo("run"),
102102
execs().stream().with_status(0)
103103
);
104+
```
105+
106+
## Logging
107+
108+
Cargo uses [`env_logger`](https://docs.rs/env_logger/*/env_logger/), so you can set
109+
`RUST_LOG` environment variable to get the logs. This is useful both for diagnosing
110+
bugs in stable Cargo and for local development. Cargo also has internal hierarchical
111+
profiling infrastructure, which is activated via `CARGO_PROFILE` variable
112+
113+
```
114+
# Outputs all logs with levels debug and higher
115+
$ RUST_LOG=debug cargo generate-lockfile
116+
117+
# Don't forget that you can filter by module as well
118+
$ RUST_LOG=cargo::core::resolver=trace cargo generate-lockfile
104119
120+
# Output first three levels of profiling info
121+
$ CARGO_PROFILE=3 cargo generate-lockfile
105122
```

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ and unexpected behavior.
2222
its users' security, please do not open a public issue on GitHub. Instead,
2323
we ask you to refer to Rust's [security policy].**
2424

25-
Opening an issue is as easy as following [this
26-
link][new-issues] and filling out the fields.
27-
Here's a template that you can use to file an issue, though it's not necessary to
28-
use it exactly:
25+
Opening an issue is as easy as following [this link][new-issues] and filling out
26+
the fields. Here's a template that you can use to file an issue, though it's not
27+
necessary to use it exactly:
2928

3029
<short summary of the problem>
3130

@@ -42,7 +41,8 @@ happened instead. Please use https://gist.github.com/ if your examples run long.
4241

4342
## Working on issues
4443

45-
If you're looking for somewhere to start, check out the [E-easy][E-Easy] tag.
44+
If you're looking for somewhere to start, check out the [E-easy][E-Easy] and
45+
[E-mentor][E-mentor] tags.
4646

4747
Feel free to ask for guidelines on how to tackle a problem on [IRC] or open a
4848
[new issue][new-issues]. This is especially important if you want to add new

0 commit comments

Comments
 (0)