Skip to content

Commit 9cb40cd

Browse files
committed
better log messages
1 parent 2cb8c13 commit 9cb40cd

2 files changed

Lines changed: 14 additions & 15 deletions

File tree

crates/stackable-operator/src/client.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ impl Client {
581581
tracing::debug!(
582582
allowed = allowed,
583583
namespace = namespace,
584-
resource = std::any::type_name::<T>(),
584+
type_name = std::any::type_name::<T>(),
585585
"object list permission from cache",
586586
);
587587

@@ -616,7 +616,7 @@ impl Client {
616616
Err(err) => {
617617
tracing::error!(
618618
namespace = namespace,
619-
resource = std::any::type_name::<T>(),
619+
type_name = std::any::type_name::<T>(),
620620
error = ?err,
621621
"failed to perform SelfSubjectAccessReview, assuming list is allowed",
622622
);
@@ -627,7 +627,7 @@ impl Client {
627627
tracing::debug!(
628628
allowed = allowed,
629629
namespace = namespace,
630-
resource = std::any::type_name::<T>(),
630+
type_name = std::any::type_name::<T>(),
631631
"object list permissions",
632632
);
633633
Ok(allowed)

crates/stackable-operator/src/cluster_resources.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use k8s_openapi::{
2525
use kube::{Resource, ResourceExt};
2626
use serde::{Serialize, de::DeserializeOwned};
2727
use snafu::{OptionExt, ResultExt, Snafu};
28-
use tracing::{debug, info, warn};
28+
use tracing::{debug, warn};
2929

3030
use crate::{
3131
client::{Client, GetApi},
@@ -714,9 +714,9 @@ impl<'a> ClusterResources<'a> {
714714
client: &Client,
715715
) -> Result<()> {
716716
if !self.apply_strategy.delete_orphans() {
717-
debug!(
718-
"Skip deleting orphaned resources because of [{}] strategy.",
719-
self.apply_strategy
717+
tracing::debug!(
718+
apply_strategy = ?self.apply_strategy,
719+
"skip deleting orphaned resources because of strategy.",
720720
);
721721
return Ok(());
722722
}
@@ -726,10 +726,9 @@ impl<'a> ClusterResources<'a> {
726726
.await
727727
.context(ListClusterResourcesSnafu)?
728728
{
729-
debug!(
730-
"Skipping deletion of orphaned {} because the operator is not allowed to list \
731-
them and is therefore probably not in charge of them.",
732-
T::plural(&())
729+
tracing::debug!(
730+
type_name = std::any::type_name::<T>(),
731+
"skipping deletion of orphans of this type because the operator is not allowed to list them",
733732
);
734733
return Ok(());
735734
}
@@ -751,10 +750,10 @@ impl<'a> ClusterResources<'a> {
751750
}
752751

753752
if !orphaned_resources.is_empty() {
754-
info!(
755-
"Deleting orphaned {}: {}",
756-
T::plural(&()),
757-
ClusterResources::print_resources(&orphaned_resources),
753+
tracing::info!(
754+
type_name = std::any::type_name::<T>(),
755+
orphans = ClusterResources::print_resources(&orphaned_resources),
756+
"deleting orphans",
758757
);
759758
for resource in orphaned_resources.iter() {
760759
client

0 commit comments

Comments
 (0)