docs: update custom log handler example#4089
Open
Galileo927 wants to merge 3 commits into
Open
Conversation
|
|
There was a problem hiding this comment.
Pull request overview
This PR updates the Getting Started SDK documentation so the custom internal log handler example matches the current GlobalLogHandler::SetLogHandler API.
Changes:
- Adds guidance to register custom log handlers as
opentelemetry::nostd::shared_ptr. - Updates the example to construct a
nostd::shared_ptr<LogHandler>before callingSetLogHandler.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4089 +/- ##
=======================================
Coverage 81.99% 81.99%
=======================================
Files 385 385
Lines 16023 16023
=======================================
Hits 13137 13137
Misses 2886 2886 🚀 New features to boost your workflow:
|
owent
approved these changes
May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3763
Changes
Updates the Getting Started custom log handler example to register the handler using
opentelemetry::nostd::shared_ptr<LogHandler>, matching the currentGlobalLogHandler::SetLogHandlerAPI.The previous documentation used
std::make_shared<CustomLogHandler>(), which does not match the exact API type whennostd::shared_ptris not an alias tostd::shared_ptr.This change also makes the documentation consistent with the SDK test pattern in
sdk/test/common/global_log_handle_test.cc.This is a documentation-only change, so no changelog entry, unit test, or public API review is required.
Please provide a brief description of the changes here.
Testing
git diff --checkSetLogHandler,CustomLogHandler, andGlobalLogHandlerusagesc++ -std=c++11 -Iapi/include -Isdk/includeFor significant contributions please make sure you have completed the following items:
CHANGELOG.mdupdated for non-trivial changes