Skip to content

Commit

Permalink
Switch adapt command messages to using tracing::event!
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottt committed Jun 5, 2024
1 parent 2b03663 commit 7a29848
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,24 +99,28 @@ pub async fn main() -> ExitCode {
let bytes = match std::fs::read(&input) {
Ok(bytes) => bytes,
Err(_) => {
eprintln!("Failed to read module from: {}", input.display());
event!(
Level::ERROR,
"Failed to read module from: {}",
input.display()
);
return ExitCode::FAILURE;
}
};

let module = match viceroy_lib::adapt::adapt_bytes(&bytes) {
Ok(module) => module,
Err(e) => {
eprintln!("Failed to adapt module: {e}");
event!(Level::ERROR, "Failed to adapt module: {e}");
return ExitCode::FAILURE;
}
};

println!("Writing component to: {}", output.display());
event!(Level::INFO, "Writing component to: {}", output.display());
match std::fs::write(output, module) {
Ok(_) => ExitCode::SUCCESS,
Err(e) => {
eprintln!("Failed to write component: {e}");
event!(Level::ERROR, "Failed to write component: {e}");
return ExitCode::FAILURE;
}
}
Expand Down

0 comments on commit 7a29848

Please sign in to comment.