@@ -99,37 +99,28 @@ class OPENTELEMETRY_EXPORT_TYPE GlobalLogHandler
9999 *
100100 * By default, a default LogHandler is returned.
101101 */
102- static inline const nostd::shared_ptr<LogHandler> &GetLogHandler () noexcept
103- {
104- return GetHandlerAndLevel ().first ;
105- }
102+ static nostd::shared_ptr<LogHandler> GetLogHandler () noexcept ;
106103
107104 /* *
108105 * Changes the singleton LogHandler.
109106 * This should be called once at the start of application before creating any Provider
110107 * instance.
111108 */
112- static inline void SetLogHandler (const nostd::shared_ptr<LogHandler> &eh) noexcept
113- {
114- GetHandlerAndLevel ().first = eh;
115- }
109+ static void SetLogHandler (const nostd::shared_ptr<LogHandler> &eh) noexcept ;
116110
117111 /* *
118112 * Returns the singleton log level.
119113 *
120114 * By default, a default log level is returned.
121115 */
122- static inline LogLevel GetLogLevel () noexcept { return GetHandlerAndLevel (). second ; }
116+ static LogLevel GetLogLevel () noexcept ;
123117
124118 /* *
125119 * Changes the singleton Log level.
126120 * This should be called once at the start of application before creating any Provider
127121 * instance.
128122 */
129- static inline void SetLogLevel (LogLevel level) noexcept { GetHandlerAndLevel ().second = level; }
130-
131- private:
132- static std::pair<nostd::shared_ptr<LogHandler>, LogLevel> &GetHandlerAndLevel () noexcept ;
123+ static void SetLogLevel (LogLevel level) noexcept ;
133124};
134125
135126} // namespace internal_log
@@ -142,24 +133,23 @@ OPENTELEMETRY_END_NAMESPACE
142133 * To ensure that GlobalLogHandler is the first one to be initialized (and so last to be
143134 * destroyed), it is first used inside the constructors of TraceProvider, MeterProvider
144135 * and LoggerProvider for debug logging. */
145- #define OTEL_INTERNAL_LOG_DISPATCH (level, message, attributes ) \
146- do \
147- { \
148- using opentelemetry::sdk::common::internal_log::GlobalLogHandler; \
149- using opentelemetry::sdk::common::internal_log::LogHandler; \
150- if (level > GlobalLogHandler::GetLogLevel ()) \
151- { \
152- break ; \
153- } \
154- const opentelemetry::nostd::shared_ptr<LogHandler> &log_handler = \
155- GlobalLogHandler::GetLogHandler (); \
156- if (!log_handler) \
157- { \
158- break ; \
159- } \
160- std::stringstream tmp_stream; \
161- tmp_stream << message; \
162- log_handler->Handle (level, __FILE__, __LINE__, tmp_stream.str ().c_str (), attributes); \
136+ #define OTEL_INTERNAL_LOG_DISPATCH (level, message, attributes ) \
137+ do \
138+ { \
139+ using opentelemetry::sdk::common::internal_log::GlobalLogHandler; \
140+ using opentelemetry::sdk::common::internal_log::LogHandler; \
141+ if (level > GlobalLogHandler::GetLogLevel ()) \
142+ { \
143+ break ; \
144+ } \
145+ opentelemetry::nostd::shared_ptr<LogHandler> log_handler = GlobalLogHandler::GetLogHandler (); \
146+ if (!log_handler) \
147+ { \
148+ break ; \
149+ } \
150+ std::stringstream tmp_stream; \
151+ tmp_stream << message; \
152+ log_handler->Handle (level, __FILE__, __LINE__, tmp_stream.str ().c_str (), attributes); \
163153 } while (false );
164154
165155#define OTEL_INTERNAL_LOG_GET_3RD_ARG (arg1, arg2, arg3, ...) arg3
0 commit comments