launchdarkly / swift-eventsource

Server-sent events (SSE) client implementation in Swift for iOS, macOS, tvOS, and watchOS
https://launchdarkly.github.io/swift-eventsource/
Other
187 stars 34 forks source link

Add a way to disable logging #77

Closed choulepoka closed 3 months ago

choulepoka commented 3 months ago

Is your feature request related to a problem? Please describe.

Yes. The logging of the LaunchDarkly iOS Client is verbose. When debugging, it is not uncommon to get hundreds of debugging statement in the console, with no easy to disable them.

Describe the solution you'd like

Create a way to disable logging, and optionally have the LaunchDarkly iOS Client configure it to match. Ideally somethings like:

Logs.logger = .disabled

Describe alternatives you've considered

Additional context

Not that I can see.

tanderson-ld commented 3 months ago

Hi @choulepoka, thank you for bringing this to our attention. If I recall correctly, you are using the LaunchDarkly iOS SDK and not just the event-source. @keelerm84 recently updated the logging implementation in the iOS SDK to use os_log which has better filtering capabilities. Would us bringing this change into the swift-eventsource meet your needs? We will have to investigate to see if that will work well with pure swift consumers of this event-source.

I have logged a story for tracking this: SC-245493

choulepoka commented 3 months ago

@tanderson-ld If you are using OSLog, we would need an exposeed public setter so that we can set the value of the OSLog to .disabled. That would would probably work if both framework actually expose something like that.

tanderson-ld commented 3 months ago

@choulepoka, we have released version swift-eventsource 3.3.0 which supports setting LDEventSource.Config.logger. We are in the process of updating the iOS SDK to pass it's logger in to the event source when it is created so that one logger is used for both. That PR is here. Leaving this issue open since I think you are looking for this change in the iOS SDK and not just in this swift-eventsource repo.

tanderson-ld commented 3 months ago

We're still working to get the iOS SDK update out that includes the fix for the iOS SDK itself.

tanderson-ld commented 3 months ago

This is now resolved in the iOS Client SDK v9.8.1