Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixup: log levels/wording #532

Merged
merged 1 commit into from
May 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions installers/binstall/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/command/graph/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/command/subgraph/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions src/utils/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl RoverEnv {
/// returns the value of the environment variable if it exists
pub fn get(&self, key: RoverEnvKey) -> io::Result<Option<String>> {
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) {
Expand All @@ -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)
Expand Down
11 changes: 9 additions & 2 deletions src/utils/telemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool, SputnikError> {
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)
}

Expand Down
6 changes: 2 additions & 4 deletions src/utils/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(&current_time)?)?;
}

Expand Down