Document how to use Cargo's internal logging
authorAleksey Kladov <aleksey.kladov@gmail.com>
Sun, 8 Apr 2018 15:28:27 +0000 (18:28 +0300)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Sun, 8 Apr 2018 15:28:27 +0000 (18:28 +0300)
ARCHITECTURE.md
CONTRIBUTING.md

index 68ce7e6cf82bee08dddce5b488b71982718b6c53..1b8577f76d2ddec3964d6b731573a9ce0dcd9da8 100644 (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
 ```
index 55b29fe15ea51f998c268d4f2469d4698af6697f..6dd831c435079885b5e1046098b435268f5f254f 100644 (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