Releases: apple/swift-log
1.6.2
What's Changed
SemVer Patch
- Fix Windows warnings by @FranzBusch in #331
Other Changes
- [CI] Migrate to GHA by @FranzBusch in #328
- Enhance swift code-block at README.md by @lamtrinhdev in #327
- add .editorconfig file by @rnro in #338
- Add Scout to the list of available backends by @kasianov-mikhail in #337
New Contributors
- @lamtrinhdev made their first contribution in #318
- @hyp made their first contribution in #325
- @rnro made their first contribution in #338
- @kasianov-mikhail made their first contribution in #337
Full Changelog: 1.6.1...1.6.2
Swift Log 1.6.1
SemVer Patch
- Disable existential any build setting (#312)
1.6.0
SemVer Minor
- Add Sendability annotations in #308
- Fix deprecation warnings around default log implementations on handlers in #310
- Drop Swift versions earlier than 5.8 in #299
- Implement Copy-On-Write (CoW) behavior for Logger struct by @ayushi2103 in #297
SemVer Patch
- Replace standardOutput to standardError by @ayushi2103 in #295
- Use Set to spot duplicated log handler warnings in #306
- Make protocol usage obvious using any and some keywords in #307
- Remove documentation for non-existent arguments by @b1ackturtle in #309
- Remove Docc plugin which is no longer required in #311
Other Changes
1.5.4
What's Changed
Cleanups & minor compatibility improvements
- Don't assume localtime() result is non-nil by @gwynne in #280
- Changes to build with Musl. by @al45tair in #283
Non code changes
- Add CocoaLumberjack to list of logging backends by @ffried in #276
- update CI script by @tomerd in #281
- Update README.md by @0xTim in #279
New Contributors
- @ffried made their first contribution in #276
- @0xTim made their first contribution in #279
- @al45tair made their first contribution in #283
Full Changelog: 1.5.3...1.5.4
1.5.3
What's Changed
Cleanups & minor compatibility improvements
- Remove leftover 5.0 Package.swift; not supported since 1.5.0 by @ktoso in #259
- Use #if canImport(Darwin) where possible by @FranzBusch in #269
- docs: fix typos by @FannyGautierr in #272
Non code changes
- Add DiscordBM/DiscordLogger to loggers list by @MahdiBM in #257
- Update CI by @yim-lee in #264
- update code of conduct by @tomerd in #268
- Fix DiscordLogger link by @MahdiBM in #266
- add kiliankoe/swift-log-matrix to list of backends by @kiliankoe in #263
New Contributors
- @MahdiBM made their first contribution in #257
- @kiliankoe made their first contribution in #263
- @FannyGautierr made their first contribution in #272
Full Changelog: 1.5.2...1.5.3
1.5.2
Primary change
Address too aggressive warning logging on LogHandlers that do not support MetadataProvider
. The warning would be emitted too frequently, resulting in flooding logs with warnings. Instead, the warning is now emitted once per log handler type.
What's Changed
- Avoid logging warnings when handler does not support metadataproviders by @ktoso in #252
- Handle providers properly in multiplex log handler by @ktoso in #254
- Add CI for Swift 5.8 and update nightly to Ubuntu 22.04 by @yim-lee in #255
Full Changelog: 1.5.1...1.5.2
1.5.1
Summary
This patch release focuses on minor cleanups to ergonomics of setting metadata providers with the default stream log handlers, and fixes a bug in the default handler not printing the provided extra metadata by default (it does now).
Thank you to @slashmo for quickly noticing and providing a patch for the latter!
What's Changed
- Allow passing explicit provider into the stream handlers by @ktoso in #250
- Emit correct metadata from StreamLogHandler by @slashmo in #251
Full Changelog: 1.5.0...1.5.1
1.5.0
Changes
Swift version support
This release drops support for Swift 5.0.
Swift 5.1+ remain supported for the time being.
Logger.MetadataProvider
This release introduces metadata providers!
They are an additional way to add metadata to your log statements automatically whenever a log statement is about to be made. This works extremely well with systems like distributed tracing, that may pick up trace identifiers and other information from the task-local context from where the log statement is being made.
The feature came with a swift evolution style proposal introduction to the "why?" and "how?" of this feature you may find interesting.
Metadata providers are used like this:
import Logging
enum Namespace {
@TaskLocal static var simpleTraceID: String?
}
let simpleTraceIDMetadataProvider = Logger.MetadataProvider {
guard let traceID = Namespace.simpleTraceID else {
return [:]
}
return ["simple-trace-id": .string(traceID)]
}
LoggingSystem.bootstrap({ label, metadataProvider in
myCoolLogHandler(label: label, metadataProvider: metadataProvider)
}, metadataProvider: simpleTraceIDMetadataProvider)
which in turn makes every Logger
on this LoggingSystem
add this contextual metadata to log statements automatically:
let log = Logger(label: "hello")
Namespace.$simpleTraceID.withValue("1234-5678") {
test()
}
func test() {
log.info("test log statement")
}
// [info] [simple-trace-id: 1234-5678] test log statement
Adoption in LogHandler
s
In order to support this new feature in your log handlers, please make it accept a MetadataProvider?
at creation, and store it as:
struct MyHandler: LogHandler {
// ...
public var metadataProvider: Logger.MetadataProvider?
// ...
}
What's Changed
Highlight
Other changes
- [docs] Minimal docc setup and landing page by @ktoso in #226
- =docc Make docs use symbol references by @ktoso in #230
- =docc Move to multiple Package.swift files by @ktoso in #231
- Undo 5.7 package files, not needed yet by @ktoso in #232
- Update README: Add missing Source param by @rusik in #233
- Fix build for wasm by @ahti in #236
- Add .spi.yml for Swift Package Index DocC support by @yim-lee in #240
- Fixes link to Supabase repository in README.md by @timobollwerk in #245
New Contributors
- @rusik made their first contribution in #233
- @ahti made their first contribution in #236
- @timobollwerk made their first contribution in #245
Full Changelog: 1.4.4...1.5.0
1.4.4
Sendable fixup for 1.4.3
The 1.4.3 release carefully introduced Sendable
across the library; sadly we missed that 5.6.x
Swift series treat a "missing marker protocol conformance for Sendable" as an error while it is intended to be a warning as which it is correctly reported in Swift 5.7.
This release fixes this by not requiring that values stored in Logger.MetadataValue.stringConvertible
must be Sendable, however practically speaking they should be thread-safe in any case, as it is not guaranteed in any way when/where this string convertible value will be invoked from.
This release contains no other changes from 1.4.3.
What's Changed
Full Changelog: 1.4.3...1.4.4
1.4.3
Highlights
Loggers and all related types are now Sendable
, including metadata values which have to be Sendable as well.
When using from Swift that is concurrency aware, you may be getting warnings where you didn't before, these are all correct though - you need to be ready for e.g. logger metadata to be accessed from another thread. Thankfully values logged this way should usually be sendable to begin with, preferably value types.
For more details see: #218
What's Changed
- Remove references to Swift 4 by @steipete in #186
- Include source in StreamLogHandler output by @slashmo in #189
- Improve StdioOutputStream with fwrite (#180) by @felipejinli in #188
- use #fileID for Swift 5.3+ by @weissi in #187
- Add
SwiftLogNoOpLogHandler.init(_: String)
by @glbrntt in #194 - update 5.4 to release docker image by @tomerd in #196
- adopt security guidelines by @weissi in #197
- Logging: avoid a deprecation warning on Windows by @compnerd in #199
- Tests: enable tests on Windows by @compnerd in #198
- Add swift-log-elk as a new logging backend to the Readme by @philippzagar in #201
- Add swift-log-SwiftyBeaver as a new logging backend to README.md by @ShivaHuang in #203
- fix jazzy issues on older versions of ubuntu by @tomerd in #210
- add docker setup for 5.5 by @tomerd in #211
- Android support by @andriydruk in #209
- update doc generation script by @tomerd in #213
- Add 5.6 nightly CI by @Lukasa in #214
- ci update by @tomerd in #219
- Add binaryscraping/swift-log-supabase to README by @GRSouza in #221
- better abstration for LoggingSystem state by @tomerd in #222
- adopt sendable by @tomerd in #218
- minimal DocC markdown to order Logger.Levels by @heckj in #225
New Contributors
- @steipete made their first contribution in #186
- @slashmo made their first contribution in #189
- @felipejinli made their first contribution in #188
- @philippzagar made their first contribution in #201
- @andriydruk made their first contribution in #209
- @Lukasa made their first contribution in #214
- @GRSouza made their first contribution in #221
- @heckj made their first contribution in #225
Full Changelog: 1.4.2...1.4.3