Repository navigation
Added custom log action - #665
Vortec4800 wants to merge 1 commit into
Conversation
|
Hi, |
|
That's the path I started to go down before I did this. Unfortunately, it doesn't work for 2 reasons. The first one, OAuthSwift.log isn't a public property, so you would need a PR on OAuthSwift to add a func to set a custom logging subclass anyway. The second issue is the default implementations are in an extension on the protocol. If you create a subclass and set it as the logging class, Swift still calls the implementations in the extension and not those in the subclass. It might be possible to reorganize everything to make it work, but the few things I tried caused errors due to the default parameters to get file and line information. This seemed like the best way to get custom logging functionality without totally re-writing the logger which didn't seem necessary. |
|
Hi, any more info on this PR? I still think it's useful functionality to be able to customize logging, but the proposed solution of using the protocol isn't possible. |
The new logging mechanism looks really useful, however, I wanted to extend it to integrate with my app's existing logging system. I added a custom log action that accepts a closure, and the log action is used instead of just printing to the console so the actual log can be customized.
This extends the work done by @svoip and the logging system.
In order to use this new functionality, you would add something like this: