Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions api/include/opentelemetry/logs/noop.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,28 @@ class NoopEventLogger final : public EventLogger
class NoopEventLoggerProvider final : public EventLoggerProvider
{
public:
# if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 4996)
# elif defined(__GNUC__) && !defined(__clang__) && !defined(__apple_build_version__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
# elif defined(__clang__) || defined(__apple_build_version__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
# endif

NoopEventLoggerProvider() : event_logger_{nostd::shared_ptr<EventLogger>(new NoopEventLogger())}
{}

# if defined(_MSC_VER)
# pragma warning(pop)
# elif defined(__GNUC__) && !defined(__clang__) && !defined(__apple_build_version__)
# pragma GCC diagnostic pop
# elif defined(__clang__) || defined(__apple_build_version__)
# pragma clang diagnostic pop
# endif

Copy link

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pragma directive blocks are duplicated across multiple files. Consider creating a macro or header file to define OPENTELEMETRY_SUPPRESS_DEPRECATED_START and OPENTELEMETRY_SUPPRESS_DEPRECATED_END to reduce code duplication and improve maintainability.

Suggested change
OPENTELEMETRY_SUPPRESS_DEPRECATED_START
NoopEventLoggerProvider() : event_logger_{nostd::shared_ptr<EventLogger>(new NoopEventLogger())}
{}
OPENTELEMETRY_SUPPRESS_DEPRECATED_END

Copilot uses AI. Check for mistakes.

nostd::shared_ptr<EventLogger> CreateEventLogger(
nostd::shared_ptr<Logger> /*delegate_logger*/,
nostd::string_view /*event_domain*/) noexcept override
Expand Down
19 changes: 19 additions & 0 deletions api/include/opentelemetry/logs/provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,27 @@ class OPENTELEMETRY_EXPORT Provider
OPENTELEMETRY_API_SINGLETON static nostd::shared_ptr<EventLoggerProvider> &
GetEventProvider() noexcept
{
# if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 4996)
# elif defined(__GNUC__) && !defined(__clang__) && !defined(__apple_build_version__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
# elif defined(__clang__) || defined(__apple_build_version__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
# endif

static nostd::shared_ptr<EventLoggerProvider> provider(new NoopEventLoggerProvider);
return provider;

# if defined(_MSC_VER)
# pragma warning(pop)
# elif defined(__GNUC__) && !defined(__clang__) && !defined(__apple_build_version__)
# pragma GCC diagnostic pop
# elif defined(__clang__) || defined(__apple_build_version__)
# pragma clang diagnostic pop
# endif
Copy link

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pragma directive blocks are duplicated across multiple files. Consider creating a macro or header file to define OPENTELEMETRY_SUPPRESS_DEPRECATED_START and OPENTELEMETRY_SUPPRESS_DEPRECATED_END to reduce code duplication and improve maintainability.

Suggested change
# endif
OPENTELEMETRY_SUPPRESS_DEPRECATED_START
static nostd::shared_ptr<EventLoggerProvider> provider(new NoopEventLoggerProvider);
return provider;
OPENTELEMETRY_SUPPRESS_DEPRECATED_END

Copilot uses AI. Check for mistakes.

}
#endif

Expand Down
Loading