Skip to content

docs(logs): clarify logger format handling#4149

Open
SyedAsadRazaDevops wants to merge 1 commit into
open-telemetry:mainfrom
SyedAsadRazaDevops:syedasadrazadevops/2628-logger-format-docs
Open

docs(logs): clarify logger format handling#4149
SyedAsadRazaDevops wants to merge 1 commit into
open-telemetry:mainfrom
SyedAsadRazaDevops:syedasadrazadevops/2628-logger-format-docs

Conversation

@SyedAsadRazaDevops

@SyedAsadRazaDevops SyedAsadRazaDevops commented Jun 11, 2026

Copy link
Copy Markdown

Description

Clarifies the logger API documentation for the format parameter. The current wording links to message templates, which can imply that placeholders are interpolated from attributes. This change documents the current behavior: the format string is stored as the log record body, and structured data should be passed through attributes.

Fixes #2628

Type of change

  • Documentation update
  • Bug fix
  • New feature
  • Breaking change

Verification

  • git diff --check
  • scripts/assert-cncf-github-identity.ps1 -RepoPath upstreams\open-telemetry\opentelemetry-cpp

No runtime behavior changed.

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.07%. Comparing base (de059ec) to head (4a538b3).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #4149   +/-   ##
=======================================
  Coverage   82.07%   82.07%           
=======================================
  Files         386      386           
  Lines       16211    16211           
=======================================
  Hits        13303    13303           
  Misses       2908     2908           
Files with missing lines Coverage Δ
api/include/opentelemetry/logs/logger.h 81.12% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

* @param severity severity of the log
* @param event_id event identifier of the log
* @param format an utf-8 string following https://messagetemplates.org/
* @param format a UTF-8 string stored as the log record body

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the new note about no SDK-side interpolation is useful, but should we avoid removing the message-template intent entirely? My understanding is that format was kept as a user-facing API concept so custom exporters or upstream agents could interpret it as a message template, even though the OpenTelemetry spec does not require the SDK itself to format it. Maybe this should say that the SDK stores the string as the log record body and does not interpolate attributes, while preserving that exporters/agents may choose to interpret it as a message template.
cc @ThomsonTan - I believe he added the original comment.

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.

Is formating for log messages actually implemented?

2 participants