Skip to content

fix(logs): implement SwiftLog event handlers#1933

Open
stephenlclarke wants to merge 3 commits into
apple:mainfrom
stephenlclarke:fix-loghandler-deprecation-warnings
Open

fix(logs): implement SwiftLog event handlers#1933
stephenlclarke wants to merge 3 commits into
apple:mainfrom
stephenlclarke:fix-loghandler-deprecation-warnings

Conversation

@stephenlclarke

Copy link
Copy Markdown

Type of Change

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

Motivation and Context

Fixes #1754.

Supersedes #1758, whose deleted fork head cannot be reattached to the closed review.

Downstream packages can resolve a newer SwiftLog than this repository's current lockfile. SwiftLog 1.13.2 makes log(event:) the primary LogHandler entry point, so relying on the compatibility bridge emits deprecation warnings for all three ContainerLog handlers.

This change updates the lockfile to SwiftLog 1.13.2 and implements the primary event entry point without changing the existing output format. Both SwiftLog entry points share the same private emission path, including handler metadata and per-event metadata merging.

What Changed

  • Updates SwiftLog from 1.10.1 to 1.13.2.
  • Implements log(event:) for FileLogHandler, OSLogHandler, and StderrLogHandler.
  • Preserves the existing log(level:message:metadata:source:file:function:line:) compatibility entry point.
  • Adds ContainerLogTests and exercises all three primary event paths.
  • Verifies that file output preserves the level and message and that event metadata overrides handler metadata.

The branch keeps dependency, implementation, and test changes in separate commits.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

Validation:

  • make swift-fmt-check
  • make test: 94 XCTest cases and 559 Swift Testing cases passed
  • swift test --disable-automatic-resolution --enable-code-coverage --filter ContainerLogHandlerTests
  • swift build --disable-automatic-resolution --target ContainerLog
  • git diff --check origin/main..HEAD

The coverage run executes each new log(event:) entry point and asserts the observable file-handler behavior.

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.

[Bug]: Resolve SwiftLog LogHandler deprecation warnings in ContainerLog handlers

1 participant