From cb5d18011b95ea5a88a78109a71222006118b02b Mon Sep 17 00:00:00 2001 From: SeongChan Lee Date: Mon, 12 Aug 2024 18:31:44 +0900 Subject: [PATCH] Fix report level --- src/webhooks/report.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/webhooks/report.rs b/src/webhooks/report.rs index d0b6d20..755d754 100644 --- a/src/webhooks/report.rs +++ b/src/webhooks/report.rs @@ -1,10 +1,9 @@ use k8s_openapi::api::core::v1::{ObjectReference, Pod}; use kube::runtime::events::{Event, EventType, Recorder}; use kube::Resource; -use tracing::{debug, enabled, info, Level}; +use tracing::{debug, event_enabled, info, warn, Level}; use crate::webhooks::AppState; - async fn report( state: &AppState, reference: ObjectReference, @@ -52,7 +51,7 @@ pub async fn debug_report_for_ref( reason: &str, note: String, ) { - if !enabled!(Level::DEBUG) { + if !event_enabled!(Level::DEBUG) { return; } @@ -77,16 +76,16 @@ pub async fn warn_report_for_ref( reason: &str, note: String, ) { - if !enabled!(Level::WARN) { + if !event_enabled!(Level::WARN) { return; } - info!(action, reason, note); + warn!(action, reason, note); report(state, object_ref, EventType::Warning, action, reason, note).await; } pub async fn report_for(state: &AppState, pod: &Pod, action: &str, reason: &str, note: String) { - if !enabled!(Level::INFO) { + if !event_enabled!(Level::INFO) { return; }