From 3678f923be9962c1cf9dfd9bf86058bb89b8834b Mon Sep 17 00:00:00 2001 From: Zach Lute Date: Sun, 27 Jan 2019 10:34:11 -0800 Subject: [PATCH] Changed RUST_LOG usage to CARGO_LOG to avoid confusion. --- ARCHITECTURE.md | 6 +++--- src/bin/cargo/main.rs | 4 ++-- src/doc/src/reference/config.md | 2 +- tests/testsuite/build.rs | 2 +- tests/testsuite/build_script.rs | 8 ++++---- tests/testsuite/check.rs | 2 +- tests/testsuite/corrupt_git.rs | 8 ++++---- tests/testsuite/doc.rs | 2 +- tests/testsuite/freshness.rs | 2 +- tests/testsuite/rustc_info_cache.rs | 14 +++++++------- tests/testsuite/small_fd_limits.rs | 2 +- tests/testsuite/update.rs | 2 +- 12 files changed, 27 insertions(+), 27 deletions(-) diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 688f891e3f5..a3bf0ebfc4f 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -117,16 +117,16 @@ to nightly rustc). ## 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 +`CARGO_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 +$ CARGO_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 +$ CARGO_LOG=cargo::core::resolver=trace cargo generate-lockfile # Output first three levels of profiling info $ CARGO_PROFILE=3 cargo generate-lockfile diff --git a/src/bin/cargo/main.rs b/src/bin/cargo/main.rs index d0a18293f6e..3ad505e4c55 100644 --- a/src/bin/cargo/main.rs +++ b/src/bin/cargo/main.rs @@ -18,9 +18,9 @@ use crate::command_prelude::*; fn main() { #[cfg(feature = "pretty-env-logger")] - pretty_env_logger::init(); + pretty_env_logger::init_custom_env("CARGO_LOG"); #[cfg(not(feature = "pretty-env-logger"))] - env_logger::init(); + env_logger::init_from_env("CARGO_LOG"); cargo::core::maybe_allow_nightly_features(); let mut config = match Config::default() { diff --git a/src/doc/src/reference/config.md b/src/doc/src/reference/config.md index da6b3c5d649..46e2995b978 100644 --- a/src/doc/src/reference/config.md +++ b/src/doc/src/reference/config.md @@ -107,7 +107,7 @@ multiplexing = true # whether or not to use HTTP/2 multiplexing where possible # This setting can be used to help debug what's going on with HTTP requests made # by Cargo. When set to `true` then Cargo's normal debug logging will be filled # in with HTTP information, which you can extract with -# `RUST_LOG=cargo::ops::registry=debug` (and `trace` may print more). +# `CARGO_LOG=cargo::ops::registry=debug` (and `trace` may print more). # # Be wary when posting these logs elsewhere though, it may be the case that a # header has an authentication token in it you don't want leaked! Be sure to diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index bd54ab648a4..825965241de 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -2267,7 +2267,7 @@ fn simple_staticlib() { .build(); // env var is a test for #1381 - p.cargo("build").env("RUST_LOG", "nekoneko=trace").run(); + p.cargo("build").env("CARGO_LOG", "nekoneko=trace").run(); } #[test] diff --git a/tests/testsuite/build_script.rs b/tests/testsuite/build_script.rs index 9c4dd7031f1..37f784e8609 100644 --- a/tests/testsuite/build_script.rs +++ b/tests/testsuite/build_script.rs @@ -1547,13 +1547,13 @@ fn build_script_with_dynamic_native_dependency() { build .cargo("build -v") - .env("RUST_LOG", "cargo::ops::cargo_rustc") + .env("CARGO_LOG", "cargo::ops::cargo_rustc") .run(); let root = build.root().join("target").join("debug"); foo.cargo("build -v") .env("BUILDER_ROOT", root) - .env("RUST_LOG", "cargo::ops::cargo_rustc") + .env("CARGO_LOG", "cargo::ops::cargo_rustc") .run(); } @@ -2406,7 +2406,7 @@ fn fresh_builds_possible_with_link_libs() { .run(); p.cargo("build -v") - .env("RUST_LOG", "cargo::ops::cargo_rustc::fingerprint=info") + .env("CARGO_LOG", "cargo::ops::cargo_rustc::fingerprint=info") .with_stderr( "\ [FRESH] foo v0.5.0 ([..]) @@ -2461,7 +2461,7 @@ fn fresh_builds_possible_with_multiple_metadata_overrides() { .run(); p.cargo("build -v") - .env("RUST_LOG", "cargo::ops::cargo_rustc::fingerprint=info") + .env("CARGO_LOG", "cargo::ops::cargo_rustc::fingerprint=info") .with_stderr( "\ [FRESH] foo v0.5.0 ([..]) diff --git a/tests/testsuite/check.rs b/tests/testsuite/check.rs index 390293d0f8e..ec36b27f8c3 100644 --- a/tests/testsuite/check.rs +++ b/tests/testsuite/check.rs @@ -726,7 +726,7 @@ fn proc_macro() { "#, ) .build(); - p.cargo("check -v").env("RUST_LOG", "cargo=trace").run(); + p.cargo("check -v").env("CARGO_LOG", "cargo=trace").run(); } #[test] diff --git a/tests/testsuite/corrupt_git.rs b/tests/testsuite/corrupt_git.rs index f71f2ec65b5..e27e8e15a0f 100644 --- a/tests/testsuite/corrupt_git.rs +++ b/tests/testsuite/corrupt_git.rs @@ -47,7 +47,7 @@ fn deleting_database_files() { } println!("deleting {}", file.display()); cargopaths::remove_file(&file).unwrap(); - project.cargo("build -v").env("RUST_LOG", log).run(); + project.cargo("build -v").env("CARGO_LOG", log).run(); if !file.exists() { continue; @@ -60,7 +60,7 @@ fn deleting_database_files() { .unwrap() .set_len(2) .unwrap(); - project.cargo("build -v").env("RUST_LOG", log).run(); + project.cargo("build -v").env("CARGO_LOG", log).run(); } } @@ -124,7 +124,7 @@ fn deleting_checkout_files() { } println!("deleting {}", file.display()); cargopaths::remove_file(&file).unwrap(); - project.cargo("build -v").env("RUST_LOG", log).run(); + project.cargo("build -v").env("CARGO_LOG", log).run(); if !file.exists() { continue; @@ -137,7 +137,7 @@ fn deleting_checkout_files() { .unwrap() .set_len(2) .unwrap(); - project.cargo("build -v").env("RUST_LOG", log).run(); + project.cargo("build -v").env("CARGO_LOG", log).run(); } } diff --git a/tests/testsuite/doc.rs b/tests/testsuite/doc.rs index 5b0aef63a45..dbc0e62251f 100644 --- a/tests/testsuite/doc.rs +++ b/tests/testsuite/doc.rs @@ -132,7 +132,7 @@ fn doc_deps() { ); p.cargo("doc") - .env("RUST_LOG", "cargo::ops::cargo_rustc::fingerprint") + .env("CARGO_LOG", "cargo::ops::cargo_rustc::fingerprint") .with_stdout("") .run(); diff --git a/tests/testsuite/freshness.rs b/tests/testsuite/freshness.rs index 9d14ca533c2..33e14fc952c 100644 --- a/tests/testsuite/freshness.rs +++ b/tests/testsuite/freshness.rs @@ -760,7 +760,7 @@ fn rebuild_if_build_artifacts_move_forward_in_time() { p.root().move_into_the_future(); p.cargo("build") - .env("RUST_LOG", "") + .env("CARGO_LOG", "") .with_stdout("") .with_stderr( "\ diff --git a/tests/testsuite/rustc_info_cache.rs b/tests/testsuite/rustc_info_cache.rs index 257aea57a9d..5ecfb5f8ef0 100644 --- a/tests/testsuite/rustc_info_cache.rs +++ b/tests/testsuite/rustc_info_cache.rs @@ -13,7 +13,7 @@ fn rustc_info_cache() { let update = "[..]updated rustc info cache[..]"; p.cargo("build") - .env("RUST_LOG", "cargo::util::rustc=info") + .env("CARGO_LOG", "cargo::util::rustc=info") .with_stderr_contains("[..]failed to read rustc info cache[..]") .with_stderr_contains(miss) .with_stderr_does_not_contain(hit) @@ -21,7 +21,7 @@ fn rustc_info_cache() { .run(); p.cargo("build") - .env("RUST_LOG", "cargo::util::rustc=info") + .env("CARGO_LOG", "cargo::util::rustc=info") .with_stderr_contains("[..]reusing existing rustc info cache[..]") .with_stderr_contains(hit) .with_stderr_does_not_contain(miss) @@ -29,7 +29,7 @@ fn rustc_info_cache() { .run(); p.cargo("build") - .env("RUST_LOG", "cargo::util::rustc=info") + .env("CARGO_LOG", "cargo::util::rustc=info") .env("CARGO_CACHE_RUSTC_INFO", "0") .with_stderr_contains("[..]rustc info cache disabled[..]") .with_stderr_does_not_contain(update) @@ -63,7 +63,7 @@ fn rustc_info_cache() { }; p.cargo("build") - .env("RUST_LOG", "cargo::util::rustc=info") + .env("CARGO_LOG", "cargo::util::rustc=info") .env("RUSTC", other_rustc.display().to_string()) .with_stderr_contains("[..]different compiler, creating new rustc info cache[..]") .with_stderr_contains(miss) @@ -72,7 +72,7 @@ fn rustc_info_cache() { .run(); p.cargo("build") - .env("RUST_LOG", "cargo::util::rustc=info") + .env("CARGO_LOG", "cargo::util::rustc=info") .env("RUSTC", other_rustc.display().to_string()) .with_stderr_contains("[..]reusing existing rustc info cache[..]") .with_stderr_contains(hit) @@ -83,7 +83,7 @@ fn rustc_info_cache() { other_rustc.move_into_the_future(); p.cargo("build") - .env("RUST_LOG", "cargo::util::rustc=info") + .env("CARGO_LOG", "cargo::util::rustc=info") .env("RUSTC", other_rustc.display().to_string()) .with_stderr_contains("[..]different compiler, creating new rustc info cache[..]") .with_stderr_contains(miss) @@ -92,7 +92,7 @@ fn rustc_info_cache() { .run(); p.cargo("build") - .env("RUST_LOG", "cargo::util::rustc=info") + .env("CARGO_LOG", "cargo::util::rustc=info") .env("RUSTC", other_rustc.display().to_string()) .with_stderr_contains("[..]reusing existing rustc info cache[..]") .with_stderr_contains(hit) diff --git a/tests/testsuite/small_fd_limits.rs b/tests/testsuite/small_fd_limits.rs index 273190810ca..2f49035b4cd 100644 --- a/tests/testsuite/small_fd_limits.rs +++ b/tests/testsuite/small_fd_limits.rs @@ -73,7 +73,7 @@ fn run_test(path_env: Option<&OsStr>) { if let Some(path) = path_env { cmd.env("PATH", path); } - cmd.env("RUST_LOG", "trace"); + cmd.env("CARGO_LOG", "trace"); cmd.run(); let after = find_index() .join(".git/objects/pack") diff --git a/tests/testsuite/update.rs b/tests/testsuite/update.rs index 91b22fb6ca4..7a95c72cc0a 100644 --- a/tests/testsuite/update.rs +++ b/tests/testsuite/update.rs @@ -205,7 +205,7 @@ fn update_via_new_dep() { Package::new("log", "0.1.1").publish(); p.uncomment_root_manifest(); - p.cargo("build").env("RUST_LOG", "cargo=trace").run(); + p.cargo("build").env("CARGO_LOG", "cargo=trace").run(); } #[test]