Skip to content

docs: update custom log handler example#4089

Merged
lalitb merged 4 commits into
open-telemetry:mainfrom
Galileo927:fix-outdated-getting-started-log-handler
May 22, 2026
Merged

docs: update custom log handler example#4089
lalitb merged 4 commits into
open-telemetry:mainfrom
Galileo927:fix-outdated-getting-started-log-handler

Conversation

@Galileo927
Copy link
Copy Markdown
Contributor

@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.
⚠️ Please upload report for BASE (main@d1723be). Learn more about missing BASE report.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #4089   +/-   ##
=======================================
  Coverage        ?   82.01%           
=======================================
  Files           ?      385           
  Lines           ?    16030           
  Branches        ?        0           
=======================================
  Hits            ?    13145           
  Misses          ?     2885           
  Partials        ?        0           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lalitb lalitb merged commit 678e011 into open-telemetry:main May 22, 2026
70 checks passed
malkia added a commit to malkia/opentelemetry-cpp that referenced this pull request May 23, 2026
docs: update custom log handler example (open-telemetry#4089)
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

6 participants