about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-09-13 07:21:31 +0000
committerbors <bors@rust-lang.org>2020-09-13 07:21:31 +0000
commit4e48010b95ed1021677420a9c74d8fed2ce424d4 (patch)
tree19772ae7c0cc277d07927927b4e806159f361470 /src/bootstrap
parentdd33766e4a9a918058c3447d42491e874e21f7cc (diff)
parent0be66d7f30ba31638e14c00bd2303dd0327964f4 (diff)
downloadrust-4e48010b95ed1021677420a9c74d8fed2ce424d4.tar.gz
rust-4e48010b95ed1021677420a9c74d8fed2ce424d4.zip
Auto merge of #76588 - guswynn:debug_logging, r=jyn514,Mark-Simulacrum
Add a dedicated debug-logging option to config.toml

`@Mark-Simulacrum` and I were talking in zulip and we found that turning on debug/trace logging in rustc is fairly confusing, as it effectively depends on debug-assertions and is not documented as such. `@Mark-Simulacrum` mentioned that we should probably have a separate option for logging anyways.

this diff adds that, having the option follow debug-assertions (so everyone's existing config.toml should be fine) and if the option is false

to test I ran ./x.py test <something> twice, once with `debug-logging = false` and once with `debug-logging = true` and made sure i only saw trace's when it was true
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/config.rs6
-rw-r--r--src/bootstrap/lib.rs10
2 files changed, 16 insertions, 0 deletions
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 000f8cef614..7c8c729b5bf 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -112,6 +112,7 @@ pub struct Config {
     pub rust_codegen_units_std: Option<u32>,
     pub rust_debug_assertions: bool,
     pub rust_debug_assertions_std: bool,
+    pub rust_debug_logging: bool,
     pub rust_debuginfo_level_rustc: u32,
     pub rust_debuginfo_level_std: u32,
     pub rust_debuginfo_level_tools: u32,
@@ -392,6 +393,7 @@ struct Rust {
     codegen_units_std: Option<u32>,
     debug_assertions: Option<bool>,
     debug_assertions_std: Option<bool>,
+    debug_logging: Option<bool>,
     debuginfo_level: Option<u32>,
     debuginfo_level_rustc: Option<u32>,
     debuginfo_level_std: Option<u32>,
@@ -600,6 +602,7 @@ impl Config {
         let mut debug = None;
         let mut debug_assertions = None;
         let mut debug_assertions_std = None;
+        let mut debug_logging = None;
         let mut debuginfo_level = None;
         let mut debuginfo_level_rustc = None;
         let mut debuginfo_level_std = None;
@@ -680,6 +683,7 @@ impl Config {
             debug = rust.debug;
             debug_assertions = rust.debug_assertions;
             debug_assertions_std = rust.debug_assertions_std;
+            debug_logging = rust.debug_logging;
             debuginfo_level = rust.debuginfo_level;
             debuginfo_level_rustc = rust.debuginfo_level_rustc;
             debuginfo_level_std = rust.debuginfo_level_std;
@@ -797,6 +801,8 @@ impl Config {
         config.rust_debug_assertions_std =
             debug_assertions_std.unwrap_or(config.rust_debug_assertions);
 
+        config.rust_debug_logging = debug_logging.unwrap_or(config.rust_debug_assertions);
+
         let with_defaults = |debuginfo_level_specific: Option<u32>| {
             debuginfo_level_specific.or(debuginfo_level).unwrap_or(if debug == Some(true) {
                 1
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 170c93561ef..91b85f5af1d 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -541,6 +541,16 @@ impl Build {
         if self.config.llvm_enabled() {
             features.push_str(" llvm");
         }
+
+        // If debug logging is on, then we want the default for tracing:
+        // https://github.com/tokio-rs/tracing/blob/3dd5c03d907afdf2c39444a29931833335171554/tracing/src/level_filters.rs#L26
+        // which is everything (including debug/trace/etc.)
+        // if its unset, if debug_assertions is on, then debug_logging will also be on
+        // as well as tracing *ignoring* this feature when debug_assertions is on
+        if !self.config.rust_debug_logging {
+            features.push_str(" max_level_info");
+        }
+
         features
     }