TelemetryDeck / SwiftSDK

Swift SDK for TelemetryDeck, a privacy-conscious analytics service for apps and websites.
https://telemetrydeck.com/
Other
155 stars 32 forks source link

Use os_log instead of print for logging #31

Closed jaanus closed 1 year ago

jaanus commented 3 years ago

Observed: Telemetry uses print-logging.

Expected: os_log is the modern recommended way of logging. Consider using that. https://developer.apple.com/documentation/os/logging/generating_log_messages_from_your_code

winsmith commented 3 years ago

That is a very good idea. Thanks for that. I'll double check if os_log is also available on Linux

jaanus commented 3 years ago

Good point. os_log isn’t available on Linux. https://github.com/apple/swift-log is the official thing to use on Linux. (And I suppose it works on other platforms too, some Server-Side Swift things like Vapor use it across all platforms, so AppTelemetry might too.)

Sherlouk commented 1 year ago

SwiftLog has the added ability of aggregating and sending logs up to a remote server for error monitoring.

I'm not sure it makes sense for this SDK to add a dependency though, and indeed it complicated the recent CocoaPods install.

Perhaps we support clients providing a simple log closure, defaulting to print if not overridden?

jaanus commented 1 year ago

Perhaps we support clients providing a simple log closure, defaulting to print if not overridden?

Yay for dependency injection. This sounds fine.