Skip to content

Commit 407c081

Browse files
committed
Skip calling otel_warn! in BatchLogProcessor::emit error case when the target name matches the crate's target name
1 parent bb48945 commit 407c081

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

opentelemetry-sdk/src/logs/batch_log_processor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ impl LogProcessor for BatchLogProcessor {
212212
// cycle. This may occur when integrating with the `tracing` crate due to
213213
// `otel_warn!` possibly calling `tracing::warn!` under the hood, which will emit
214214
// the warning back into the otel log processor.
215-
if matches!(record.event_name, Some(event_name) if event_name != Self::AFTER_SHUTDOWN_WARNING_NAME)
215+
if matches!((record.event_name, record.target()), (Some(event_name), Some(target_name)) if !(event_name == Self::AFTER_SHUTDOWN_WARNING_NAME && target_name == env!("CARGO_CRATE_NAME")))
216216
{
217217
// Given background thread is the only receiver, and it's
218218
// disconnected, it indicates the thread is shutdown

0 commit comments

Comments
 (0)