Skip to content

Commit

Permalink
Add some info log
Browse files Browse the repository at this point in the history
  • Loading branch information
riseshia committed Aug 21, 2024
1 parent 0790f00 commit d7a6978
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
17 changes: 9 additions & 8 deletions src/commands/apply.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::collections::HashMap;

use anyhow::{bail, Result};
use tracing::info;

use crate::context::FuburaContext;
use crate::differ::diff;
Expand Down Expand Up @@ -48,42 +49,42 @@ Enter a value: "#
for diff_op in diff_ops_for_ss.diff_ops.iter() {
match diff_op {
DiffOp::CreateState => {
println!("Creating state machine: {}", state.name);
info!("Creating state machine: {}", state.name);
sfn::create_state_machine(&context.sfn_client, state).await?;
}
DiffOp::UpdateState => {
let state_arn = format!("{}{}", state_arn_prefix, state.name);
println!("Updating state machine: {}", state.name);
info!("Updating state machine: {}", state.name);
sfn::update_state_machine(&context.sfn_client, &state_arn, state).await?;
}
DiffOp::DeleteState => {
let state_arn = format!("{}{}", state_arn_prefix, state.name);
println!("Deleting state machine: {}", state.name);
info!("Deleting state machine: {}", state.name);
sfn::delete_state_machine(&context.sfn_client, &state_arn).await?;
}
DiffOp::AddStateTag => {
let state_arn = format!("{}{}", state_arn_prefix, state.name);
println!("Adding tags to state machine: {}", state.name);
info!("Adding tags to state machine: {}", state.name);
sfn::tag_resource(&context.sfn_client, &state_arn, &state.tags).await?;
}
DiffOp::RemoveStateTag(removed_keys) => {
let state_arn = format!("{}{}", state_arn_prefix, state.name);
println!("Removing tags from state machine: {}", state.name);
info!("Removing tags from state machine: {}", state.name);
sfn::untag_resource(&context.sfn_client, &state_arn, removed_keys).await?;
}
DiffOp::CreateSchedule => {
let schedule = ss_config.schedule.as_ref().unwrap();
println!("Creating schedule: {}", schedule.name);
info!("Creating schedule: {}", schedule.name);
scheduler::create_schedule(&context.scheduler_client, schedule).await?;
}
DiffOp::UpdateSchedule => {
let schedule = ss_config.schedule.as_ref().unwrap();
println!("Updating schedule: {}", schedule.name);
info!("Updating schedule: {}", schedule.name);
scheduler::update_schedule(&context.scheduler_client, schedule).await?;
}
DiffOp::DeleteSchedule => {
let schedule = ss_config.schedule.as_ref().unwrap();
println!("Deleting schedule: {}", schedule.name);
info!("Deleting schedule: {}", schedule.name);
scheduler::delete_schedule(&context.scheduler_client, schedule).await?;
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/differ.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::collections::HashSet;
use anyhow::{bail, Result};
use console::Style;
use similar::{ChangeTag, TextDiff};
use tracing::info;

use crate::{
context::FuburaContext,
Expand Down Expand Up @@ -273,9 +274,11 @@ pub async fn diff(context: &FuburaContext, config: &Config) -> Result<DiffResult
for ss_config in target_ss_configs {
let state_arn = format!("{}{}", state_arn_prefix, ss_config.state.name);

info!("Describing state machine: {}", &state_arn);
let remote_state =
sfn::describe_state_machine_with_tags(&context.sfn_client, &state_arn).await?;

info!("Describing schedule: {}", &state_arn);
let remote_schedule = if let Some(schedule_config) = &ss_config.schedule {
scheduler::get_schedule(
&context.scheduler_client,
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn set_log_level(debug_mode: &bool) {
.with(filter)
.init();

info!("Set log level to {:?}", fubura_level);
info!("Set log level: {:?}", fubura_level);
}

#[tokio::main]
Expand Down

0 comments on commit d7a6978

Please sign in to comment.