fix(logs): implement SwiftLog event handlers#1933
Conversation
3f8d6f3 to
6355f13
Compare
|
@stephenlclarke Sorry that I didn't see your work sooner on this! We've had to focus on other items lately and haven't been able work on the issue and PR backlog. I stumbled across the default implementation deprecation when updating our Package.resolved files, and changed the loggers to use Event in #1981. I did the same for the vminitd logger in containerization in apple/containerization#808. Do those look sufficient to close #1754? Separately, I'll look over your apple/containerization#799 PR today. |
|
Yes—#1981 and apple/containerization#808 cover the production and vminitd handlers that motivated this change. I have also reconciled both merged commits into the downstream fork and the logging tests remain green. I am closing this PR as superseded. Thank you for following up. |
Type of Change
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 primaryLogHandlerentry point, so relying on the compatibility bridge emits deprecation warnings for all threeContainerLoghandlers.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
log(event:)forFileLogHandler,OSLogHandler, andStderrLogHandler.log(level:message:metadata:source:file:function:line:)compatibility entry point.ContainerLogTestsand exercises all three primary event paths.The branch keeps dependency, implementation, and test changes in separate commits.
Testing
Validation:
make swift-fmt-checkmake test: 94 XCTest cases and 559 Swift Testing cases passedswift test --disable-automatic-resolution --enable-code-coverage --filter ContainerLogHandlerTestsswift build --disable-automatic-resolution --target ContainerLoggit diff --check origin/main..HEADThe coverage run executes each new
log(event:)entry point and asserts the observable file-handler behavior.