MasterJ93 / ATProtoKit

A straightforward solution for using AT Protocol and Bluesky, written in Swift.
https://atprotokit.cjrriley.com/documentation/atprotokit/
MIT License
40 stars 8 forks source link

[Feature Request]: Replace print function with Logger #7

Closed KC-2001MS closed 6 months ago

KC-2001MS commented 7 months ago

Summary

I want to use Logger to open the line where the log occurred in Xcode.

Pain points

I would like to switch from using the print function to using Logger in order to debug my project more efficiently. As shown in the following session, the combination of Xcode15 and Logger allows for easier debugging. https://developer.apple.com/wwdc23/10226 I am also currently adding an Extension to this Logger in the forked repository. I have not done this because trying to replace all print statements would require changing a few more files. Definitions only.

Considered Alternatives

Compared to the print function used in debugging, this function is superior in that it can easily transition to the part in question.

Is this a breaking change?

No

Library Examples

No response

Additional Context

No response

MasterJ93 commented 7 months ago

Thanks for your suggestion. I'm going to be using swift-log for logging purposes. However, I do believe that using print() everywhere isn't ideal. This was only temporary while I was busy making converting all of the lexicons into models and methods. Now that I've completed most of them, I'll look into adding swift-log, as well as your suggestion, in the next couple of weeks. While it may seem unnecessary to add two loggers, the reason is because, to my knowledge, OSLog doesn't work anywhere other than Apple's platforms, and this project aims to be compatible with Linux as well as Apple's platforms. So a solution is needed to do that. My apologies that it'll take some time.

KC-2001MS commented 7 months ago

You're right, I was missing the thought about Log on non-Apple platforms. Adding that requirement, swift-log might be a better fit. Also, I'd like to build a social networking app, and I'd like to help complete this framework as much as possible. I may do a pull request, but I apologize in advance for my lack of experience with open source contributions.

MasterJ93 commented 7 months ago

I am still going to implement your suggestion. I've come up with a potential solution to this by combining both OSLog and swift-log into one class, thereby making it easy for developers to choose one or the other. So I will be doing that.

As for pull requests, I am okay with that as well.

MasterJ93 commented 6 months ago

The underlying parts of the logging have been completed. I'll be adding the logs over to the other files over time. Thanks again for the suggestion. I apologize for not doing much in the project until now, I've been extremely busy with other things.

The pull request reopen and close over time until all of the places that need logs have been successfully added.

KC-2001MS commented 6 months ago

I was too busy to reply here as well. My apologies. Thank you for your response. Don't be in too much of a hurry, it's inevitable that there will be glitches before release.