From 20a74e787f29c8ac3bbbecdc34c1487423d7b163 Mon Sep 17 00:00:00 2001 From: mdecimus Date: Tue, 23 Apr 2024 19:55:19 +0200 Subject: [PATCH] Allow only one journald tracer (closes #375) --- crates/common/src/config/tracers.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/common/src/config/tracers.rs b/crates/common/src/config/tracers.rs index fa390dcf..af24f076 100644 --- a/crates/common/src/config/tracers.rs +++ b/crates/common/src/config/tracers.rs @@ -165,7 +165,14 @@ impl Tracers { } } "journal" => { - tracers.push(Tracer::Journal { level }); + if !tracers.iter().any(|t| matches!(t, Tracer::Journal { .. })) { + tracers.push(Tracer::Journal { level }); + } else { + config.new_build_error( + ("tracer", id, "type"), + "Only one journal tracer is allowed".to_string(), + ); + } } unknown => { config.new_parse_error(