Skip to content

Commit

Permalink
Add logging support & some preliminary logging
Browse files Browse the repository at this point in the history
This is just generally nice to have, and is already a transitive
dependency, so let's go ahead.
  • Loading branch information
cmyr committed Oct 12, 2023
1 parent 7754a4c commit cbea179
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
32 changes: 32 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ chrono = "0.4.6"
structopt = { version = "^0.3", default-features = false }
semver = "1.0"
termcolor = "1.0"
env_logger = "0.10.0"
log = "0.4.20"
3 changes: 3 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use crate::opt::{AppConfig, CargoOpts, Target};
pub(crate) fn run(app_config: AppConfig) -> Result<()> {
// 1. Detect the type of Xcode Instruments installation
let xctrace_tool = instruments::XcodeInstruments::detect()?;
log::debug!("using {xctrace_tool}");

// 2. Render available templates if the user asked
if app_config.list_templates {
Expand Down Expand Up @@ -56,6 +57,8 @@ pub(crate) fn run(app_config: AppConfig) -> Result<()> {
}
};

log::debug!("running against target {}", target_filepath.display());

#[cfg(target_arch = "aarch64")]
codesign(&target_filepath, &workspace)?;

Expand Down
11 changes: 10 additions & 1 deletion src/instruments.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! interfacing with the `instruments` command line tool

use std::fmt::Write;
use std::fmt::{Display, Write};
use std::fs;
use std::path::{Path, PathBuf};
use std::process::{Command, Output};
Expand Down Expand Up @@ -485,6 +485,15 @@ fn get_tty() -> Result<Option<String>> {
.map(|tty| format!("/dev/{}", tty)))
}

impl Display for XcodeInstruments {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
XcodeInstruments::XcTrace => f.write_str("xctrace"),
XcodeInstruments::InstrumentsBinary => f.write_str("legacy instruments binary"),
}
}
}

#[cfg(test)]
mod test {
use super::*;
Expand Down

0 comments on commit cbea179

Please sign in to comment.