Fixes#519.
## Motivation
When both `logLevel` and `handler` are provided, `withLogger` sets the
level on the current handler before replacing it. Since
`Logger.logLevel` forwards to the handler, the replacement discards the
requested level and uses its own instead.
## Modifications
- Install the replacement handler before applying the explicit log level
in both sync and async overloads.
- Add regression tests for `.debug` and `.warning` in both overloads,
covering filtering and scope isolation.
## Result
The scoped logger filters messages at the requested level.
Regression tests fail before the fix and pass afterward. All 172 tests
pass on macOS with Swift 6.4. Formatting and `git diff --check` also
pass.
The support window is 3 latest minor Swift versions. CI i already
running for Swift 6.2, 6.3 and 6.4 only. Updating the Swift tools and
the package to match this.
Only quote leaf metadata values.
### Motivation:
There are several issues with how nested `MetadataValue`s are handled:
1. For highly nested (10k+) metadata, `.description` and `==` operator
hit stack overflow. This is probably not very realistic depth, but
still.
2. For not so highly nested metadata (starting at about 20)
`.description` and `==` operator get very computationally intensive
because of re-escaping of the already escaped children. This makes the
above stack overflow crash not reachable in practice.
3. This also results in simple structured metadata to be rendered
something like
`["[\"[\\\"[\\\\\\\"[\\\\\\\\\\\\\\\"leaf\\\\\\\\\\\\\\\"]\\\\\\\"]\\\"]\"]"]`.
4. Finally, even after solving the re-quoting and stack over flow on
rendering, there is still an issue of [recursion in
`.deinit`](https://github.com/swiftlang/swift/issues/58080), resulting
in a _different_ stack overflow crash.
This PR provides a fix for 2 and 3, leaving 1 and 4 out because there is
no practical way of fixing it in this package, while the case is
borderline unrealistic.
### Modifications:
- Only quote left `String` and `StringRepresentable` values in
`Logger.MetadataValue.description`.
- Add benchmarks for metadata values description rendering.
### Result:
100 nested metadata values render cleanly.
Resolves#515
### Alternatives
This is discussable if this fix is really necessary. Iterative approach,
because of allocations, is slower than recursion.
- Is it worth fixing the recursion, or a metadata depth check is enough?
- Is it worth fixing the nested metadata formatting?
### Motivation:
Nightly CI on nightly-main toolchains started failing on August 11, when
we started downloading swift-DEVELOPMENT-SNAPSHOT-2026-08-08 instead of
swift-DEVELOPMENT-SNAPSHOT-2026-07-11.
Appears to be fallout from
https://github.com/swiftlang/swift/commit/73fee3394d3102847fef26c1bdea49a67061f043
improving the optionality and concurrency of stdout/stderr/stdin on the
various platforms.
### Modifications:
Adapted Swift Log code to handle both the existing and behavior, guarded
by a `compiler(>=6.5)`
Also enabled nightly-next, which tracks the pre-release 6.4 right now,
but hasn't received this change.
### Result:
Passing CI, hopefully :)
### Motivation:
The two deprecated `LogHandler` defaults forward to each other: the
source-carrying `log(level:message:metadata:source:file:function:line:)`
default calls `log(event:)`, whose default calls the source-carrying
method, and the SwiftLog 1.0
`log(level:message:metadata:file:function:line:)` default calls the
source-carrying method. A handler that implements only `log(event:)`, as
the protocol documentation asks, therefore recurses until the stack
overflows whenever anything calls the 1.0 method on it. Handlers written
against SwiftLog 1.0 that wrap another handler and forward through the
1.0 method reach this path.
Differs from #248, where the handler implemented no log method at all.
### Modifications:
The 1.0 default builds a `LogEvent` and calls `log(event:)` directly.
The source is still the module derived from `file`, as before. Two tests
in `CompatibilityTest`: the 1.0 method reaching an event-only handler
(SIGSEGV at `main` before the change) and reaching a source-only
handler.
### Result:
A `LogHandler` implementing only `log(event:)` can be called through
every deprecated entry point. No source-breaking change; both deprecated
defaults remain.
Verified on Linux with Swift 6.1.2: `swift test -Xswiftc
-warnings-as-errors --explicit-target-dependency-import-check error
-Xswiftc -require-explicit-sendable` (166 tests) and `swift-format lint
--strict` on the changed files.
Found by an automated audit loop (Claude); patch and description
reviewed by me.
---------
Co-authored-by: Vladimir Kukushkin <kukushechkin@apple.com>
### Motivation:
`Logger.MetadataValue.attributes` documents the setter as a no-op for
`.dictionary` and `.array`, but it calls `assertionFailure` there. Debug
builds trap, release builds do the documented no-op.
### Modifications:
Doc comment only. The assertion stays; the comment now says setting
attributes on a collection value is a programmer error, that debug
builds assert and release builds leave the value unchanged, and to set
attributes on the leaf values instead.
### Result:
The documentation matches the code. No behaviour change.
Found by an automated audit loop (Claude); patch and description
reviewed by me.
### Motivation:
`public` init has no effect for an `internal` class.
### Modifications:
Removed `public` from the `ReadWriteLock.init`.
### Result:
`ReadWriteLock.init` is now `internal`, matching class visibility.
Document best practice for creating complex `LogHandlers`.
### Motivation:
`LogHandler`s often need an expensive resource to write or export log
events. This pattern should be documented.
### Modifications:
Add "Constructing handlers that need more than a label" section to
`ImplementingALogHandler.md` guide.
### Result:
Closes#80.
---------
Co-authored-by: Joseph Heck <j_heck@apple.com>
Add CMake build support to the project to enable toolchain integration
and bootstrapping compatibility.
### Motivation:
Currently, swift-log does not support building with CMake. This addition
resolves issue #484, allowing swift-log to be resolved and compiled
within CMake-based environments (like the repos swift-certificates and
swift-argument-parser which aer mentioned in the issue).
### Modifications:
1. **Project Root Config:** Added
[CMakeLists.txt](file:///Users/adityamitra/Developer/swift-log/CMakeLists.txt)
configuring the CMake project with Swift 6 and C, alongside setting up
compiler flags for MSVC runtime library on Windows.
2. **Helper Modules:** Added the `cmake/` folder:
- `SwiftSupport.cmake`: dylib/module installations and triple detection
helper.
- `SwiftLogConfig.cmake.in`: package config export templates.
3. **Target CMake Configurations:** Created
[Sources/Logging/CMakeLists.txt](file:///Users/adityamitra/Developer/swift-log/Sources/Logging/CMakeLists.txt)
&
[Sources/InMemoryLogging/CMakeLists.txt](file:///Users/adityamitra/Developer/swift-log/Sources/InMemoryLogging/CMakeLists.txt)
to define the library targets. Included generator expressions pointing
`INTERFACE_INCLUDE_DIRECTORIES` to target output directories for Xcode
generator support.
4. **SwiftPM Exclusions:** Excluded the new CMake files from target
targets inside
[Package.swift](file:///Users/adityamitra/Developer/swift-log/Package.swift)
and
[Package@swift-6.1.swift](file:///Users/adityamitra/Developer/swift-log/Package@swift-6.1.swift)
to keep SwiftPM targets warning-free.
5. **Compile Options Variable:** Consolidates compile options under a
single global definition `SWIFT_LOG_COMMON_COMPILE_OPTIONS` in the root
configuration, enabling Swift 6 compiler features (`ExistentialAny`,
`MemberImportVisibility`, `InternalImportsByDefault`,
`NonisolatedNonsendingByDefault`, and explicit Sendable checks) across
all targets.
6. **CI Integration & Workflow:** Integrated CMake CI validation in
`.github/workflows/pull_request.yml` using the shared workflow from
`apple/swift-nio/.github/workflows/cmake_tests.yml@main` running in a
`swift:6.1-jammy` container. This job compiles the core libraries and
verifies the validity of the CMake files.
7. **License Header Compliance:** Cleaned up license headers across all
CMake files
### Result:
* **SwiftPM:** All 164 unit tests compile and pass successfully under
`swift test` with no warnings.
* **CMake:** Successfully compiles (`** BUILD SUCCEEDED **`) under Xcode
generator (`cmake -B build -G Xcode && cmake --build build`).
### Issue Tracking:
Fixes#484
---------
Co-authored-by: Vladimir Kukushkin <kukushechkin@apple.com>
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>
Add a Best Practice guide on how to test logging.
### Motivation:
There are 2 recommended ways of propagating logs in components, both are
testable. But there is no any kind of documentation on how to do it.
### Modifications:
Add a "Testing code that logs" Best Practice guide.
### Result:
Logs testing is now documented.
---------
Co-authored-by: Joseph Heck <j_heck@apple.com>
Expands on @kukushechkin #474 (add-missing API) and tacks in some
additional work
### Motivation:
resolve the DocC warnings
### Modifications:
- resolves docc warnings for soundness checks
- updates curation to drop the task-local logger updates into the
correct areas
- updates curation to collect the implemented proposals together
### Result:
Hopefully no issues with soundness checks
---------
Co-authored-by: Vladimir Kukushkin <kukushechkin@apple.com>
This proposal adds task-local logger storage so that metadata can
accumulate across async
call stacks without threading a `Logger` through every function
signature.
### Motivation:
Metadata propagation requires threading a logger through every layer.
Every function on
the path from request ingress to the bottom of the call stack has to
accept, mutate, and
forward a `Logger`. Libraries must choose between polluting their public
API with a `logger:` parameter and
losing all the caller's context. There is no third option today.
### Modifications:
- New API surface for reading and modifying the `@TaskLocal` `Logger`
instance added.
- Best practices on how to correctly propagate logger into libraries
updated with `Logger.current` API.
### Result:
Users can now automatically propagate accumulated metadata into
libraries without explicitly passing loggers through the API boundaries.
---------
Co-authored-by: Franz Busch <privat@franz-busch.de>
This proposal adds task-local logger storage so that metadata can
accumulate across async
call stacks without threading a `Logger` through every function
signature.
### Motivation:
Metadata propagation requires threading a logger through every layer.
Every function on
the path from request ingress to the bottom of the call stack has to
accept, mutate, and
forward a `Logger`. Libraries must choose between polluting their public
API with a `logger:` parameter and
losing all the caller's context. There is no third option today.
### Modifications:
SLG-0006 proposal is added.
### Result:
Proposal is ready for review.
Add [Default String
Interpolation](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0477-default-interpolation-values.md)
overloads for `MetadataValue` to restore compatibility with
`\(default:)` interpolation.
### Motivation:
1.13.0 introduced a breaking change to the default string interpolation
compatibility. We do not want to revert the custom string interpolation,
but can fix compatibility with the default string interpolation as much
as possible.
### Modifications:
Add `\(default:)` overloads to `MetadataValue.StringInterpolation`,
similar to the once in `DefaultStringInterpolation`.
### Result:
Compatibility with `logger.info("Log message", metadata: ["value":
"\(value, default: "none")"])` is restored.
Proposal discussion thread:
https://forums.swift.org/t/proposal-slg-0004-metadata-value-attributes-revision-2/86488
Add an extensible per-value attribute mechanism for metadata.
### Motivation:
Metadata values in `swift-log` are opaque strings by the time the
`LogHandler` receives them. The call site often
knows things about a value that the handler cannot infer — for example,
whether the value should be redacted in
different environments.
### Modifications:
- SLG-0004 proposal is updated based on the feedback.
- Added `AttributedStringCarrier: CustomStringConvertible`-based
mechanism to `Logging`.
- Added benchmarks and benchmark thresholds for the new attributed
metadata.
### Result:
`swift-log` provides an optional extensible mechanism for attaching
attributes to metadata values.
---------
Co-authored-by: Franz Busch <privat@franz-busch.de>
Skip handler dispatch for setters under `MaxLogLevelNone`
### Motivation
* When `MaxLogLevelNone` is enabled every
`Logger.trace`/`debug`/.../`critical` method and `Logger.log(level:)`
compiles down to an empty body, so no log statement can ever observe
what the underlying `LogHandler` sees.
* Despite this, the `subscript(metadataKey:)` and `logLevel` setters
still went through the handler. Code like `logger[metadataKey:
"user-id"] = "\(id)"` would CoW the logger storage and call into the
handler even though nothing could read the metadata back out via a log
statement.
### Modifications
* Wrap the bodies of `Logger.subscript(metadataKey:) { set }` and
`Logger.logLevel { set }` in `#if !MaxLogLevelNone`, mirroring the
existing guards on the level-specific log methods.
* Note this behaviour in `DisableLogLevelsDuringCompilation.md` so
callers know reads still go through the handler but writes do not.
* Add a new benchmark which ensures that the operations don't allocate.
* Update some missed swift-tools-version bumps.
* Loosen p90 instruction threshold to 10%. The same source produces
results that swing by up to ~8% between back-to-back runs.
### Result
* `logger[metadataKey:] = ...` and `logger.logLevel = ...` compile to
empty bodies when `MaxLogLevelNone` is set, matching the
zero-runtime-overhead guarantee the trait already provides for log
emission.
* Resolves https://github.com/apple/swift-log/issues/462
> [!IMPORTANT]
> This is a revision of SLG-0004 previously discussed
[here](https://forums.swift.org/t/proposal-slg-0004-metadata-values-privacy-attribute/85249/15).
Add an extensible per-value attribute mechanism for metadata.
### Motivation:
Metadata values in `swift-log` are opaque strings by the time the
`LogHandler` receives them. The call site often
knows things about a value that the handler cannot infer — for example,
whether the value should be redacted in
different environments, or additional value type information.
### Modifications:
- SLG-0004 proposal is updated based on the feedback in the first round
of discussion.
### Result:
Revised SLG-0004 proposal is ready for review.
Improve readability by extracting separate types to their own files
### Motivation:
`Logger.swift` is >2000 LoC, which makes it hard to navigate both for
contributors and users of `swift-log`. Widely different concepts, such
as concrete `LogHandler` implementations, are mixed with core types such
as `Logger.Level`. Extracting separate types should make it easier to
find what you are looking for.
Closes#441
### Modifications:
* Extract all (not `Logger`-namespaced) types from `Logging.swift` to
separate files.
* Rename `Logging.swift` to `Logger.swift`, as this is the only
remaining top-level type.
* Change `LoggingSystem.factory` from `fileprivate` to `internal` to be
accessible from `Logger.swift`.
### Result:
Each (non-private) top-level type lives in a separate file, named after
the type.
---------
Co-authored-by: Vladimir Kukushkin <kukushechkin@mac.com>
Update documentation to reflect recent changes
### Motivation:
The documentation was not updated in SLG-0003 or SLG-0005. Concretely,
the examples given in the documentation used the now deprecated
multiparameter methods in `LogHandler`, and the new `LogEvent`-based
method were not listed among the others. Likewise, the new logging
methods (`Logger.trace` etc.) that take an `Error` as a parameter were
not added. Lastly, `LogEvent` had no separate entry.
While the default rendered docs for these were acceptable, it decreased
the discoverability of the new methods, and the examples using
deprecated methods were misleading.
### Modifications:
* Update all code examples to use non-deprecated methods.
* List all new methods on `Logger` and `LogHandler` along the existing
ones.
* Add a minimal file for `LogEvent` to give it the same look as all
other types.
* Update code examples in `.md` files to follow swift format.
### Result:
Documentation reflects the current state and best practices of
`swift-log`.
---------
Co-authored-by: Joseph Heck <j_heck@apple.com>
Co-authored-by: Vladimir Kukushkin <kukushechkin@mac.com>
Add new methods on `Logger` that allows the caller to attach `Error`s to
log events, which will be propagated to the `LogHandler` as-is.
### Motivation:
Error information is typically of high interest in logs and log
analysis. Currently, however, there is no standardized way of attaching
`Error` information to logs, forcing users to either append it to the
log message (`logger.warning("Something went wrong: \(error)")`), or
attach it as metadata. By providing a separate parameter for this, and
passing it as-is to the `LogHandler`, we both provide a standard,
visible way to attach it, while also letting the `LogHandler` format it
as it sees fit.
Closes#291
### Modifications:
* New methods on `Logger` that accept an (optional) `Error`.
* An `error` property is added to `LogEvent`, which contains the `Error`
from the new `Logger` methods.
* Adjust `LogHandler` implementations to serialize error as metadata.
### Result:
Users of `Logger` can use the new methods to attach `Error`s to their
logs, which should help unify how `Error`s get logged in various code
bases.
`LogHandler` implementations can use the new `error` property on
`LogEvent` and serialize it in a way that's suitable for that
implementation. In general, extracting the string representation and the
(qualified) type name should be a good baseline.
---------
Co-authored-by: Vladimir Kukushkin <kukushechkin@mac.com>
### Motivation:
SLG-0005 is implemented and released in 1.11.0.
### Modifications:
Update status to 'Approved'.
### Result:
The proposal reflects the actual status.
This proposal introduces an **attributed metadata system** that allows
attaching attributes to metadata values. Privacy level is the first
concrete attribute, enabling developers to mark metadata values as
`.private` or `.public` so `LogHandler` implementations can redact
sensitive values before logging.
### Motivation:
SwiftLog lacks a mechanism to attach attributes to metadata values as
sensitive to allow Log Handlers to control logging behavior.
### Modifications:
Added the SLG-004 proposal, introducing attributed metadata values
mechanism and privacy levels for metadata values.
### Result:
Proposal is ready for review.
Review result: the proposal is not accepted and needs rework.
Rewrites the default log handler to avoid typing out what the C file
pointer looks like on different platforms.
This fixes#374 - as we do not make any assumptions at compile time
about what `FILE*` is imported as in Swift.
Replace the flat-parameter
`log(level:message:metadata:source:file:function:line:)` method on
`LogHandler` with
`log(event: LogEvent)`, enabling forward-compatible evolution of the
`LogHandler` interface without breaking existing
handler implementations.
### Motivation:
Changes to the `LogHandler` API require dance around creating new
overloads, deprecating old overloads, which unnecessary bloats
`LogHandler` protocol surface (like happened with the source:
parameter). We have upcoming changes that would introduce new
capabilities to the `LogHandler` protocol, for example
https://forums.swift.org/t/proposal-slg-0003-standardized-error-metadata-via-logger-convenience/84518/35.
It makes sense to introduce a single container structure for all the
data associated with a log event before introducing any new overloads in
`LogHandler` protocol.
### Modifications:
- New struct `LogEvent` is added.
- `LogHandler` protocol now has an additional `log(event: LogEvent)`
method.
- `Logger` is calling handler's `log(event: LogEvent)` method.
### Result:
Further changes to the `LogEvent` with new information passed from the
`Logger` to a `LogHandler` does not require changes in the `LogHandler`
API. As a bonus, `LogEvent` makes `source` a computable variable,
improving performance for log handlers who do not need the default
source created based on the log file location.
Replace the flat-parameter
`log(level:message:metadata:source:file:function:line:)` method on
`LogHandler` with
`log(event: LogEvent)`, enabling forward-compatible evolution of the
`LogHandler` interface without breaking existing
handler implementations.
### Motivation:
Changes to the `LogHandler` API require dance around creating new
overloads, deprecating old overloads, which unnecessary bloats
`LogHandler` protocol surface (like happened with the source:
parameter). We have upcoming changes that would introduce new
capabilities to the `LogHandler` protocol, for example
https://forums.swift.org/t/proposal-slg-0003-standardized-error-metadata-via-logger-convenience/84518/35.
It makes sense to introduce a single container structure for all the
data associated with a log event before introducing any new overloads in
`LogHandler` protocol.
### Modifications:
- SLG-0005 proposal added.
### Result:
Proposal is ready for implementation.
The reason the proposal has
Add a proposal for the standardized way of attaching data from Error instances to log
posts.
### Motivation:
Addresses https://github.com/apple/swift-log/issues/291
### Modifications:
The "SLG-0003" proposal doc added.
### Result:
The proposal is ready for review.
---------
Co-authored-by: Vladimir Kukushkin <kukushechkin@mac.com>
I've added support for FreeBSD. I've only tested this PR on FreeBSD, but
I believe it should also work on OpenBSD.
### Motivation:
closes#372
Also, [Swift on FreeBSD preview
toolchain](https://forums.swift.org/t/swift-on-freebsd-preview/83064) is
now available.
### Modifications:
- changed pthread-related code for *BSD
- changed `Glibc.stdout` and `Glibc.stderr` for *BSD because they are
non-optional on *BSD
### Result:
swift-log and packages depending on it will be usable on FreeBSD.
### Checks:
I tested it with `swift build` and `swift test`. All tests have passed.
```console
$ swift test
...
Test Suite 'All tests' passed at 2025-11-07 04:29:34.003
Executed 0 tests, with 0 failures (0 unexpected) in 0.0 (0.0) seconds
...
✔ Test run with 52 tests in 7 suites passed after 0.309 seconds.
```
Environment:
```console
$ uname -a
FreeBSD Coconut-rhinoceros-beetle 15.0-BETA4 FreeBSD 15.0-BETA4 releng/15.0-n280841-a7707f2a3bf4 GENERIC amd64
$ swift --version
Swift version 6.3-dev (LLVM bff1370bd79c983, Swift 57cf4ce563f700b)
Target: x86_64-unknown-freebsd14.3
Build config: +assertions
```
Swift toolchain is from
https://forums.swift.org/t/swift-on-freebsd-preview/83064.
---------
Co-authored-by: Franz Busch <f.busch@apple.com>
Add compile-time traits for eliminating log levels from binaries
### Motivation:
Applications often know in advance which log levels will never be needed
in production. For example, a production service might only need warning
and above, while trace and debug levels are only useful during
development. This PR introduces
compile-time traits that completely eliminate unwanted log levels from
binaries, achieving zero runtime overhead for disabled log statements.
### Modifications:
- Added seven `MaxLogLevel*` traits
- Extended benchmarks with the `MaxLogLevelWarning` suite
- Added "Disable log levels during compilation" section to the best
practices guide
### Result:
Users can eliminate unwanted log levels at compile time by specifying
traits in their `Package.swift` dependency declaration.
Enable compile-time elimination of log levels to achieve zero runtime
overhead for logs that will never be needed in production.
### Motivation:
In production deployments, applications often know in advance which log
levels will never be needed. For example, a production service typically
only needs warning and above, while trace and debug levels are
exclusively useful during development. Currently, even with the log
level set to `.warning` at runtime, the code for trace and debug
statements still exists in the binary and incurs overhead.
### Modifications:
The "SLG-0002: Compile-time log level elimination using traits" proposal
doc added.
### Result:
The proposal is ready for implementation.
Conform `Logger.Level` to `CustomStringConvertible` and
`LosslessStringConvertible`.
### Motivation:
There are libraries, such as Vapor, that add these conformances
privately and `@retroactive`ly. This would avoid having to implement
these conformances manually in each library and would unify and
standardise the implementation.
### Modifications:
Make `Logger.Level` conform to `CustomStringConvertible` and
`LosslessStringConvertible`, adding a public `description` computed
property that returns the `rawValue` and a public initializer that takes
a `description` string, lowercases it, and passes it to the `rawValue`
initializer.
### Result:
`Logger.Level` conforms to `CustomStringConvertible` and
`LosslessStringConvertible`.
Make InMemoryLogging available on all platforms
### Motivation:
Users might want to adopt the in memory logger on lower platform
versions.
### Modifications:
Remove availability annotations by using swift-logs own Lock instead of
Mutex
### Result:
In memory logger can be used on all platforms that swift-log supports
Move single pre-process proposal file to the new location.
### Motivation:
To have all the proposals in one place.
### Modifications:
One .md file moved.
### Result:
All proposals are in one place.
Add an InMemoryLogHandler
### Motivation:
Library maintainers should be able to test that their libraries log what
they expect
### Modifications:
Create a new InMemoryLogging product, which contains an
InMemoryLogHandler
This log handler can be used to make a logger, pass the logger into some
function, and then assert that logs were emitted.
See the tests for example usage
### Future:
For now i have left this very bare-bones. We could in future add
convenience functions. For example
- a function to assert that a particular log message was logged
- a static function to create a logger with this handler
---------
Co-authored-by: Franz Busch <privat@franz-busch.de>
Provide organization (aka curation) and abstracts for all of the public
types in the library.
### Motivation:
Updates to the documentation to fill in the missing abstracts for the
provided types, updating the language to follow Apple developer content
guidelines, and fixing smaller typos and grammar issues.
### Modifications:
Curation files added to provide organization for public types, ordering
the content to align with the narrative content provided earlier.
Updating API comments, adding abstracts and parameters where missing,
and moving some of the getting started content that was previously in
the main index into a separate article.
### Result:
starting point
```
--- Experimental coverage output enabled. ---
| Abstract | Curated | Code Listing
Types | 69% (11/16) | 38% (6/16) | 25% (4/16)
Members | 57% (54/94) | 3.2% (3/94) | 0.0% (0/94)
Globals | 7.1% (1/14) | 7.1% (1/14) | 7.1% (1/14)
```
Updated:
```
| Abstract | Curated | Code Listing
Types | 94% (15/16) | 94% (15/16) | 38% (6/16)
Members | 85% (80/94) | 97% (91/94) | 0.0% (0/94)
Globals | 14% (2/14) | 100% (14/14) | 7.1% (1/14)
```
---------
Co-authored-by: Honza Dvorsky <honza@apple.com>
Co-authored-by: Franz Busch <privat@franz-busch.de>
Make Swift 6.0 the minimum support version.
### Motivation:
`swift-log` supports 3 latest Swift releases, which is at this point
6.0, 6.1 and 6.2. Swift 5 is no longer supported.
### Modifications:
- Package.swift swift tools
- CI configs
- Imports checking if compiler is <6.0
### Result:
Swift 5 is no longer supported.
Co-authored-by: Honza Dvorsky <honza@apple.com>
### Motivation:
`StreamLogHandler` has at some point in time acquired an extra
whitespace:
```
2025-07-18T10:09:12+0100 notice label : hello
^
|
this one is superfluous
```
but we don't typically put spaces in front of `:`s. This PR changes it
to
```
2025-07-18T10:09:12+0100 notice label: hello
^
|
no extra space
```
Additionally, if the label is empty (`""`), then we shouldn't print any
spaces there. So with an empty label, we go from
```
2025-07-18T10:09:12+0100 notice : hello
^^
|
two superfluous spaces
```
to
```
2025-07-18T10:09:12+0100 notice: hello
^
|
no extra spaces
```
### Modifications:
- Remove superfluous space if label is not empty
- Remove two superfluous spaces if label is empty
### Result:
- Somewhat more compact output
- Nicer output
# Motivation
In my previous PR, I overhauled the README and the DocC catalog. While
doing this I removed the guidance around how to implement a log handler.
# Modifications
This PR adds a DocC based guide containing the contents of the previous
README guidance.
# Result
Guidance around log handler implementation in a modern DocC format.