Skip to content

docs: update custom log handler example#4089

Open
Galileo927 wants to merge 3 commits into
open-telemetry:mainfrom
Galileo927:fix-outdated-getting-started-log-handler
Open

docs: update custom log handler example#4089
Galileo927 wants to merge 3 commits into
open-telemetry:mainfrom
Galileo927:fix-outdated-getting-started-log-handler

Conversation

@Galileo927
Copy link
Copy Markdown

@Galileo927 Galileo927 commented May 18, 2026

Fixes #3763

Changes

Updates the Getting Started custom log handler example to register the handler using opentelemetry::nostd::shared_ptr<LogHandler>, matching the current GlobalLogHandler::SetLogHandler API.

The previous documentation used std::make_shared<CustomLogHandler>(), which does not match the exact API type when nostd::shared_ptr is not an alias to std::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

  • Ran git diff --check
  • Searched SetLogHandler, CustomLogHandler, and GlobalLogHandler usages
  • Compiled the revised snippet with c++ -std=c++11 -Iapi/include -Isdk/include

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

Copilot AI review requested due to automatic review settings May 18, 2026 03:28
@Galileo927 Galileo927 requested a review from a team as a code owner May 18, 2026 03:28
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented May 18, 2026

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: Galileo927 / name: Galileo927 (e3cb801)

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 calling SetLogHandler.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.99%. Comparing base (026af08) to head (602530c).

Additional details and impacted files

Impacted file tree graph

@@           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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Outdated getting started docs

4 participants