Skip to content

Conversation

@pfandrade
Copy link

As per discussion #293, this PR adds support for using swift-log for SyncEngine logs.

More precisely it adds a new SQLiteDataSwiftLog trait that allows for conditionally using swift-log instead of OSLog (which remains the default). Since the Logger API of both solutions is essentially the same, very little code needed to change.

Main changes are on Logging.swift, where the check for SQLiteDataSwiftLog is performed, and a typealias SyncEngine.Logger is defined.

One decision I made that I'm not quite sure about is using @_exported in Logging.swift to export the right Logger type. Doing this avoids having to do the #if SQLiteDataSwiftLog dance to import either swift-log or OSLog in any file that uses it1.

Footnotes

  1. I believe, currently, just SyncEngine.swift would need to this import dance. But if logging is needed anywhere else, or if that file gets split up, we'd have to replicate the dance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant