mirror of
https://github.com/apple/swift-log
synced 2026-11-24 03:47:49 +00:00
Make `StreamLogHandler` initializers public. ### Motivation: Closes https://github.com/apple/swift-log/issues/273 ### Modifications: Promote the two stream-accepting initializers from `internal` to `public`. Also as a result, their stream parameter is spelled out as `any TextOutputStream & Sendable` rather than the internal `_SendableTextOutputStream` typealias, which cannot appear in a public signature. ~The private stored property and the internal typealias are otherwise unchanged.~ The internal typealias has been completely removed as it was only used to store the stream, and the private stored property is updated to use the spelled-out type. Also updates the docc documentation accordingly. ### Result: Users would be able to construct a `StreamLogHandler` with their own `TextOutputStream` implementation, reusing the existing logic to format log messages and prettify metadata instead of reimplementing them. --------- Signed-off-by: subhramit <subhramit.bb@live.in> Co-authored-by: Vladimir Kukushkin <kukushechkin@apple.com>
28 lines
539 B
Markdown
28 lines
539 B
Markdown
# ``Logging/StreamLogHandler``
|
|
|
|
## Topics
|
|
|
|
### Creating a stream log handler
|
|
|
|
- ``standardOutput(label:)``
|
|
- ``standardOutput(label:metadataProvider:)``
|
|
- ``standardError(label:)``
|
|
- ``standardError(label:metadataProvider:)``
|
|
- ``init(label:stream:)``
|
|
- ``init(label:stream:metadataProvider:)``
|
|
|
|
### Sending log messages
|
|
|
|
- ``log(event:)``
|
|
- ``log(level:message:metadata:source:file:function:line:)``
|
|
|
|
### Updating metadata
|
|
|
|
- ``subscript(metadataKey:)``
|
|
|
|
### Inspecting a log handler
|
|
|
|
- ``logLevel``
|
|
- ``metadata``
|
|
- ``metadataProvider``
|