From 17c3bc66d44338d1a34ce1456b47897179d8811a Mon Sep 17 00:00:00 2001 From: WenTao Ou Date: Tue, 28 May 2024 15:04:49 +0800 Subject: [PATCH] [API] DO not allow unsafe `Logger::EmitLogRecord` (#2673) --- api/include/opentelemetry/logs/logger_type_traits.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/api/include/opentelemetry/logs/logger_type_traits.h b/api/include/opentelemetry/logs/logger_type_traits.h index aea2173689..486135137d 100644 --- a/api/include/opentelemetry/logs/logger_type_traits.h +++ b/api/include/opentelemetry/logs/logger_type_traits.h @@ -4,6 +4,7 @@ #pragma once #include +#include #include #include "opentelemetry/common/attribute_value.h" @@ -145,6 +146,10 @@ struct LogRecordSetterTrait template struct LogRecordSetterTrait { + static_assert(!std::is_same, ValueType>::value && + !std::is_same, ValueType>::value, + "unique_ptr is not allowed, please use std::move()"); + template ::value || std::is_convertible::value,