use serde_json::Value;
pub fn log_command_received(value: &Value) {
let command_type = value.get("type").and_then(Value::as_str);
tracing::info!(
action = "command_received",
command_type,
"command_received"
);
}
pub fn log_validation_result(ok: bool) {
let outcome = if ok { "ok" } else { "error" };
tracing::info!(
action = "validation_result",
ok,
outcome,
"validation_result"
);
}
pub fn log_host_start(command_type: &str) {
tracing::info!(action = "host_start", command_type, "host_start");
}
pub fn log_host_result(ok: bool) {
let outcome = if ok { "ok" } else { "error" };
tracing::info!(action = "host_result", ok, outcome, "host_result");
}
pub fn log_error(stage: &str, detail: &str) {
tracing::error!(action = "error", stage, detail, "error");
}