Skip to content

Preserve structured properties from existing logging arguments - #478

Open
Radek Maziarka (rmaziarka) wants to merge 2 commits into
Azure:v4.xfrom
rmaziarka:v4.x
Open

Radek Maziarka (rmaziarka) wants to merge 2 commits into
Azure:v4.xfrom
rmaziarka:v4.x

Conversation

@rmaziarka

@rmaziarka Radek Maziarka (rmaziarka) commented Sep 29, 2026 •

Copy link
Copy Markdown

Project

Problem

Proposed solution

  • Keep context.log/info/warn/error(...args: unknown[]); no new logging method.
  • Explicit startup opt-in; proposed option: structuredLogProperties: 'lastPlainObject'.
  • Extract properties from the final argument when it is a plain object, including a null-prototype object.
  • Preserve format(...args) exactly; the object remains in the message and additionally supplies structured fields.
  • Flat strings, booleans and finite numbers; skip unsupported values and reserved keys with bounded diagnostics.
  • Forward properties through PR 1's metadata contract; expose them to log hooks.
  • Default disabled; unsupported worker retains the existing message and produces a warning.
  • Tests: opt-in, unchanged formatting, scalar validation, JavaScript edge cases and old-worker behavior.
  • Dependency: released worker capability and core types from PR 1.

Validation

  • Core type declarations and the registration adapter restrict structured logging options to log hooks.

  • 471 tests passed, including public type checks. Build and lint passed.

  • Combined integration test: local Functions host, modified packages and live Application Insights; 30 records verified across CommonJS, ESM, disabled opt-in, missing consumer and old-worker scenarios.

  • Verified message preservation, custom dimensions, severity and invocation correlation. Not tested in managed Azure Functions; rollout requires coordinated releases.

@rmaziarka
Radek Maziarka (rmaziarka) requested a review from a team as a code owner September 29, 2026 09:14
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

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.

1 participant