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

chore: improve -vv logging #8910

Merged
merged 1 commit into from
Aug 2, 2024
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
10 changes: 9 additions & 1 deletion crates/turborepo-lib/src/run/scope/change_detector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,15 @@ impl<'a> GitChangeDetector for ScopeChangeDetector<'a> {
}

let lockfile_contents = self.get_lockfile_contents(from_ref, &changed_files);
debug!("changed_files: {changed_files:?}");

debug!(
"changed files: {:?}",
&changed_files
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed_files os an vector of AnchoredSystemPathBuf, updating the log to remove the type info so it's a little eaiser to read

.iter()
.map(|x| x.to_string())
.collect::<Vec<String>>()
);

match self
.change_mapper
.changed_packages(changed_files, lockfile_contents)?
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-repository/src/package_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl From<RawPnpmConfig> for PnpmConfig {

impl PackageJson {
pub fn load(path: &AbsoluteSystemPath) -> Result<PackageJson, Error> {
tracing::debug!("loading package.json from {}", path);
tracing::trace!("loading package.json from {}", path);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is call N times in a monorepo with N packages, making -vv logging very noisy. I think it's better to put this in -vvv (trace) logging

let contents = path.read_to_string()?;
Self::load_from_str(&contents, path.as_str())
}
Expand Down
4 changes: 2 additions & 2 deletions crates/turborepo-telemetry/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use chrono::{DateTime, Utc};
pub use config::{Config, ConfigError, File, FileFormat};
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
use tracing::{debug, error};
use tracing::{error, trace};
use turbopath::{AbsoluteSystemPath, AbsoluteSystemPathBuf};
use turborepo_dirs::config_dir;
use turborepo_ui::{color, BOLD, GREY, UI, UNDERLINE};
Expand Down Expand Up @@ -67,7 +67,7 @@ impl TelemetryConfig {
}

pub fn new(config_path: AbsoluteSystemPathBuf) -> Result<TelemetryConfig, ConfigError> {
debug!("Telemetry config path: {}", config_path);
trace!("Telemetry config path: {}", config_path);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is being called a billion times becuase .with_default_config_path() is called a lot. Generally think when something is called a lot, it should be trace logging. Aggregations are more useful for debug logging

if !config_path.exists() {
write_new_config(&config_path)?;
}
Expand Down
Loading