Files
swift-log/Sources/Logging/Docs.docc/Reference/StreamLogHandler.md
T
Subhramit BasuandVladimir Kukushkin 1895d78a91 Make StreamLogHandler initializers public (#477)
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>
2026-06-25 16:24:26 +01:00

539 B

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