-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SwiftLog + OSLog StringInterpolation #208
Comments
@ShivaHuang / @ktoso / @weissi / @tomerd – If any of you are able to take a look, I'd love to know if this is something that might make sense in the actual library itself. I'm guessing not if it's not already been done. There are likely other platform specific issues I'm unaware of. But I thought I'd ask the question in case this is something that might be worthy of a more complete PR? Also, I'm only referring to the string interpolation implementation, not the formatter I've included in my repo as that's obviously not relevant here. Thanks. |
@shaps80 this cannot be added to SwiftLog without changing API. Also, SwiftLog encourages you to add variable data in the metadata section. For example:
If you need log privacy, then I would encourage this strategy in your logging backend:
OSLog's API assumes that every piece of software can always tell whether something is private or not. But that's difficult to tell. For example in most cases a URL for a HTTP library is not private data. But in certain cases it may be. That's why I'd encourage you to use the above way. The reason that SwiftLog encourages to put all variable data in the metadata has a couple of reasons:
|
Interesting, I guess the ergonomics for an API using that approach are less than ideal though. Hence why I thought the OSLog approach was more appropriate, particularly for apps. Still, thank you for clarifying this really helped and I'll do some more thinking on your feedback above. Really appreciate you taking the time to respond 👍 |
I just wanted to share a library I've made that adds string interpolation to the SwiftLog implementation.
Unfortunately I couldn't see a way to do this without copy/pasting the code (would love any ideas on improving this) but I have kept the code almost entirely untouched and the copyright notices in tact of course.
I am not submitting a PR as I'm fairly certain this is pretty Apple platforms specific and wouldn't make sense in other environments.
But in case its useful to anyone else, here it is: https://github.com/shaps80/Logging
I've started adding tests as well and the implementation is not yet complete, but any feedback/issues/contributions are certainly welcome.
The text was updated successfully, but these errors were encountered: