apple / apple/swift-log

`Logger.MetadataProvider.multiplex` returns optional

Open
#443 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Swift
Stars
4k
Forks
344
Avg merge
1d 11h
Merged PRs (30d)
5

Description

Unless there is some reasoning I can't find on the repo or forums, this is a basic type discrepancy from [SLG-0001](https://github.com/apple/swift-log/blob/6f3fbace6629c8fcabcd56d211501e92e1919a94/Sources/Logging/Docs.docc/Proposals/SLG-0001-metadata-providers.md?plain=1#L161) and an instance is always provided anyways.

PR: https://github.com/apple/swift-log/pull/442

It is annoying to fallback to force unwrap (which looks spooky) or making an empty provider for coalescing:

```swift
.multiplex(myProviders) ?? .init({[:]})
```

---

Aside: I would also request some cleanup around `MetadataProvider.init` to take an `autoclosure`'d `Metadata`, rather than enforcing the closure style.

Contributor guide

Open the contributing guide

Research direction

Start with Logger.MetadataProvider.multiplex and compare its declaration with SLG-0001-metadata-providers.md at the cited line. Review PR 442 and the surrounding API usage to identify any required updates; done means the return type matches the proposal without optional fallback, while the separate MetadataProvider initializer request remains out of scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.