File tree Expand file tree Collapse file tree 15 files changed +30
-30
lines changed Expand file tree Collapse file tree 15 files changed +30
-30
lines changed Original file line number Diff line number Diff line change @@ -132,16 +132,16 @@ to nightly rustc).
132
132
## Logging
133
133
134
134
Cargo uses [ ` env_logger ` ] , so you can set
135
- ` RUST_LOG ` environment variable to get the logs. This is useful both for diagnosing
135
+ ` CARGO_LOG ` environment variable to get the logs. This is useful both for diagnosing
136
136
bugs in stable Cargo and for local development. Cargo also has internal hierarchical
137
137
profiling infrastructure, which is activated via ` CARGO_PROFILE ` variable
138
138
139
139
```
140
140
# Outputs all logs with levels debug and higher
141
- $ RUST_LOG =debug cargo generate-lockfile
141
+ $ CARGO_LOG =debug cargo generate-lockfile
142
142
143
143
# Don't forget that you can filter by module as well
144
- $ RUST_LOG =cargo::core::resolver=trace cargo generate-lockfile
144
+ $ CARGO_LOG =cargo::core::resolver=trace cargo generate-lockfile
145
145
146
146
# Output first three levels of profiling info
147
147
$ CARGO_PROFILE=3 cargo generate-lockfile
Original file line number Diff line number Diff line change @@ -20,9 +20,9 @@ use crate::command_prelude::*;
20
20
21
21
fn main ( ) {
22
22
#[ cfg( feature = "pretty-env-logger" ) ]
23
- pretty_env_logger:: init ( ) ;
23
+ pretty_env_logger:: init_custom_env ( "CARGO_LOG" ) ;
24
24
#[ cfg( not( feature = "pretty-env-logger" ) ) ]
25
- env_logger:: init ( ) ;
25
+ env_logger:: init_from_env ( "CARGO_LOG" ) ;
26
26
cargo:: core:: maybe_allow_nightly_features ( ) ;
27
27
28
28
let mut config = match Config :: default ( ) {
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ impl TargetInfo {
75
75
. arg ( "___" )
76
76
. arg ( "--print=file-names" )
77
77
. args ( & rustflags)
78
- . env_remove ( "RUST_LOG " ) ;
78
+ . env_remove ( "RUSTC_LOG " ) ;
79
79
80
80
let target_triple = requested_target
81
81
. as_ref ( )
Original file line number Diff line number Diff line change 79
79
//! quick loading and comparison.
80
80
//! - A `.json` file that contains details about the Fingerprint. This is only
81
81
//! used to log details about *why* a fingerprint is considered dirty.
82
- //! `RUST_LOG =cargo::core::compiler::fingerprint=trace cargo build` can be
82
+ //! `CARGO_LOG =cargo::core::compiler::fingerprint=trace cargo build` can be
83
83
//! used to display this log information.
84
84
//! - A "dep-info" file which contains a list of source filenames for the
85
85
//! target. This is produced by reading the output of `rustc
@@ -936,7 +936,7 @@ impl DepFingerprint {
936
936
impl StaleFile {
937
937
/// Use the `log` crate to log a hopefully helpful message in diagnosing
938
938
/// what file is considered stale and why. This is intended to be used in
939
- /// conjunction with `RUST_LOG ` to determine why Cargo is recompiling
939
+ /// conjunction with `CARGO_LOG ` to determine why Cargo is recompiling
940
940
/// something. Currently there's no user-facing usage of this other than
941
941
/// that.
942
942
fn log ( & self ) {
Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ multiplexing = true # whether or not to use HTTP/2 multiplexing where possible
113
113
# This setting can be used to help debug what's going on with HTTP requests made
114
114
# by Cargo. When set to `true` then Cargo's normal debug logging will be filled
115
115
# in with HTTP information, which you can extract with
116
- # `RUST_LOG =cargo::ops::registry=debug` (and `trace` may print more).
116
+ # `CARGO_LOG =cargo::ops::registry=debug` (and `trace` may print more).
117
117
#
118
118
# Be wary when posting these logs elsewhere though, it may be the case that a
119
119
# header has an authentication token in it you don't want leaked! Be sure to
Original file line number Diff line number Diff line change @@ -2028,7 +2028,7 @@ fn simple_staticlib() {
2028
2028
. build ( ) ;
2029
2029
2030
2030
// env var is a test for #1381
2031
- p. cargo ( "build" ) . env ( "RUST_LOG " , "nekoneko=trace" ) . run ( ) ;
2031
+ p. cargo ( "build" ) . env ( "CARGO_LOG " , "nekoneko=trace" ) . run ( ) ;
2032
2032
}
2033
2033
2034
2034
#[ test]
Original file line number Diff line number Diff line change @@ -1547,13 +1547,13 @@ fn build_script_with_dynamic_native_dependency() {
1547
1547
1548
1548
build
1549
1549
. cargo ( "build -v" )
1550
- . env ( "RUST_LOG " , "cargo::ops::cargo_rustc" )
1550
+ . env ( "CARGO_LOG " , "cargo::ops::cargo_rustc" )
1551
1551
. run ( ) ;
1552
1552
1553
1553
let root = build. root ( ) . join ( "target" ) . join ( "debug" ) ;
1554
1554
foo. cargo ( "build -v" )
1555
1555
. env ( "BUILDER_ROOT" , root)
1556
- . env ( "RUST_LOG " , "cargo::ops::cargo_rustc" )
1556
+ . env ( "CARGO_LOG " , "cargo::ops::cargo_rustc" )
1557
1557
. run ( ) ;
1558
1558
}
1559
1559
@@ -2460,7 +2460,7 @@ fn fresh_builds_possible_with_multiple_metadata_overrides() {
2460
2460
. run ( ) ;
2461
2461
2462
2462
p. cargo ( "build -v" )
2463
- . env ( "RUST_LOG " , "cargo::ops::cargo_rustc::fingerprint=info" )
2463
+ . env ( "CARGO_LOG " , "cargo::ops::cargo_rustc::fingerprint=info" )
2464
2464
. with_stderr (
2465
2465
"\
2466
2466
[FRESH] foo v0.5.0 ([..])
Original file line number Diff line number Diff line change @@ -730,7 +730,7 @@ fn proc_macro() {
730
730
"# ,
731
731
)
732
732
. build ( ) ;
733
- p. cargo ( "check -v" ) . env ( "RUST_LOG " , "cargo=trace" ) . run ( ) ;
733
+ p. cargo ( "check -v" ) . env ( "CARGO_LOG " , "cargo=trace" ) . run ( ) ;
734
734
}
735
735
736
736
#[ test]
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ fn deleting_database_files() {
47
47
}
48
48
println ! ( "deleting {}" , file. display( ) ) ;
49
49
cargopaths:: remove_file ( & file) . unwrap ( ) ;
50
- project. cargo ( "build -v" ) . env ( "RUST_LOG " , log) . run ( ) ;
50
+ project. cargo ( "build -v" ) . env ( "CARGO_LOG " , log) . run ( ) ;
51
51
52
52
if !file. exists ( ) {
53
53
continue ;
@@ -60,7 +60,7 @@ fn deleting_database_files() {
60
60
. unwrap ( )
61
61
. set_len ( 2 )
62
62
. unwrap ( ) ;
63
- project. cargo ( "build -v" ) . env ( "RUST_LOG " , log) . run ( ) ;
63
+ project. cargo ( "build -v" ) . env ( "CARGO_LOG " , log) . run ( ) ;
64
64
}
65
65
}
66
66
@@ -124,7 +124,7 @@ fn deleting_checkout_files() {
124
124
}
125
125
println ! ( "deleting {}" , file. display( ) ) ;
126
126
cargopaths:: remove_file ( & file) . unwrap ( ) ;
127
- project. cargo ( "build -v" ) . env ( "RUST_LOG " , log) . run ( ) ;
127
+ project. cargo ( "build -v" ) . env ( "CARGO_LOG " , log) . run ( ) ;
128
128
129
129
if !file. exists ( ) {
130
130
continue ;
@@ -137,7 +137,7 @@ fn deleting_checkout_files() {
137
137
. unwrap ( )
138
138
. set_len ( 2 )
139
139
. unwrap ( ) ;
140
- project. cargo ( "build -v" ) . env ( "RUST_LOG " , log) . run ( ) ;
140
+ project. cargo ( "build -v" ) . env ( "CARGO_LOG " , log) . run ( ) ;
141
141
}
142
142
}
143
143
Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ fn doc_deps() {
115
115
assert_eq ! ( p. glob( "target/debug/deps/libbar-*.rmeta" ) . count( ) , 1 ) ;
116
116
117
117
p. cargo ( "doc" )
118
- . env ( "RUST_LOG " , "cargo::ops::cargo_rustc::fingerprint" )
118
+ . env ( "CARGO_LOG " , "cargo::ops::cargo_rustc::fingerprint" )
119
119
. with_stdout ( "" )
120
120
. run ( ) ;
121
121
You can’t perform that action at this time.
0 commit comments