From 9ad5ba96c19d954c3e99637716dc447db705a386 Mon Sep 17 00:00:00 2001 From: Avery Harnish Date: Tue, 11 May 2021 10:53:05 -0500 Subject: [PATCH] fixup: log levels/wording (#532) --- installers/binstall/src/install.rs | 7 +++++-- src/command/graph/publish.rs | 2 +- src/command/subgraph/publish.rs | 2 +- src/utils/env.rs | 4 ++-- src/utils/telemetry.rs | 11 +++++++++-- src/utils/version.rs | 6 ++---- 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/installers/binstall/src/install.rs b/installers/binstall/src/install.rs index 295439e9c..ecf494167 100644 --- a/installers/binstall/src/install.rs +++ b/installers/binstall/src/install.rs @@ -71,8 +71,11 @@ impl Installer { fn write_bin_to_fs(&self) -> Result<(), InstallerError> { let bin_path = self.get_bin_path()?; - tracing::debug!("copying from: {}", &self.executable_location); - tracing::debug!("copying to: {}", &bin_path); + tracing::debug!( + "copying \"{}\" to \"{}\"", + &self.executable_location, + &bin_path + ); // attempt to remove the old binary // but do not error if it doesn't exist. let _ = fs::remove_file(&bin_path); diff --git a/src/command/graph/publish.rs b/src/command/graph/publish.rs index ca9924e59..06f66860c 100644 --- a/src/command/graph/publish.rs +++ b/src/command/graph/publish.rs @@ -47,7 +47,7 @@ impl Publish { let schema_document = load_schema_from_flag(&self.schema, std::io::stdin())?; - tracing::debug!(?schema_document); + tracing::debug!("Publishing \n{}", &schema_document); let publish_response = publish::run( publish::publish_schema_mutation::Variables { diff --git a/src/command/subgraph/publish.rs b/src/command/subgraph/publish.rs index 35a341096..04e75e4e7 100644 --- a/src/command/subgraph/publish.rs +++ b/src/command/subgraph/publish.rs @@ -72,7 +72,7 @@ impl Publish { let schema_document = load_schema_from_flag(&self.schema, std::io::stdin())?; - tracing::debug!("Schema Document to publish:\n{}", &schema_document); + tracing::debug!("Publishing \n{}", &schema_document); // This response is used to check whether or not the current graph is federated. let federated_response = is_federated::run( diff --git a/src/utils/env.rs b/src/utils/env.rs index 873c0dff5..71d7d88fe 100644 --- a/src/utils/env.rs +++ b/src/utils/env.rs @@ -33,7 +33,7 @@ impl RoverEnv { /// returns the value of the environment variable if it exists pub fn get(&self, key: RoverEnvKey) -> io::Result> { let key_str = key.to_string(); - tracing::debug!("Checking for ${}", &key_str); + tracing::trace!("Checking for ${}", &key_str); let result = match &self.mock_store { Some(mock_store) => Ok(mock_store.get(&key_str).map(|v| v.to_owned())), None => match env::var(&key_str) { @@ -54,7 +54,7 @@ impl RoverEnv { if let Some(result) = &result { tracing::debug!("read {}", self.get_debug_value(key, result)); } else { - tracing::debug!("could not find #{}", &key_str); + tracing::trace!("could not find ${}", &key_str); } Ok(result) diff --git a/src/utils/telemetry.rs b/src/utils/telemetry.rs index 5ab03b451..a03aef807 100644 --- a/src/utils/telemetry.rs +++ b/src/utils/telemetry.rs @@ -75,14 +75,21 @@ impl Report for Rover { let json_args = serde_json::to_string(&self)?; let mut value_args = serde_json::from_str(&json_args)?; let serialized_command = get_command_from_args(&mut value_args); - tracing::debug!(serialized_command = ?serialized_command); + tracing::debug!(?serialized_command); Ok(serialized_command) } fn is_telemetry_enabled(&self) -> Result { let value = self.env_store.get(RoverEnvKey::TelemetryDisabled)?; let is_telemetry_disabled = value.is_some(); - tracing::debug!(is_telemetry_disabled); + if is_telemetry_disabled { + tracing::info!("Telemetry has been disabled."); + } else { + tracing::info!( + "Telemetry is enabled. To disable, set ${}=1", + RoverEnvKey::TelemetryDisabled.to_string() + ) + } Ok(!is_telemetry_disabled) } diff --git a/src/utils/version.rs b/src/utils/version.rs index 8ba8fc90c..9de822804 100644 --- a/src/utils/version.rs +++ b/src/utils/version.rs @@ -31,20 +31,18 @@ pub fn check_for_update(config: config::Config, force: bool) -> Result<()> { do_update_check(&mut checked, force)?; } else if let Some(last_checked_time) = last_checked_time { let time_since_check = current_time.duration_since(last_checked_time)?.as_secs(); - tracing::debug!( + tracing::trace!( "Time since last update check: {:?}h", time_since_check / ONE_HOUR ); if time_since_check > ONE_DAY { do_update_check(&mut checked, force)?; - } else { - tracing::debug!("No need to check for updates. Automatic checks happen once per day"); } } if checked { - tracing::debug!("Checked for available updates. Writing current time to disk"); + tracing::trace!("Checked for available updates. Writing current time to disk"); fs::write(&version_file, toml::to_string(¤t_time)?)?; }