apple/swift-log

make Logger Sendable

Closed this issue · 6 comments

Logger should be Sendable because that's required almost everywhere now :).

ktoso commented

Yeap sounds good -- can you send in a pr?

It's complicated. Logger obvs needs a ref to the LogHandler and LogHandler is the public protocol. So we'd need to require LogHandler to be Sendable which is SemVer major...

So want me to make it @unchecked Sendable? That kinda feels not right either. Said that I think the API docs require thread-safetey so we could do that 😬 . WDYT?

I don't think that @unchecked Sendable is a good solution here, and I strongly believe that a semver major that requires your log handlers to be Sendable is a good move.

With Swift 5.6, LogHandler could inherit from Sendable and be annotated with @preconcurrency. This would spit out a warning on LogHandler implementations that don't fulfill the Sendable requirements.

for visibility: #218

resolved via #218