-
Notifications
You must be signed in to change notification settings - Fork 150
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
Logging isn't available on non-Darwin platforms #678
Comments
I long for the day For now I have written a log handler for swift-log to log using This solution is not great for the well-known reasons:
My next intended step is to write a macro ( #if canImport(os)
os.Logger(...)
#endif
swiftLogLogger.log(...) The design solution I have is to only allow logging Having first-class support from Apple for a unified solution would be much better indeed. |
Yup, using |
Perhaps some It’s a big headache to support two logging APIs. For example, in my The earlier we propose changes to |
We'd love to make swift-log more compatible with oslog, but currently it's not practical to make oslog fit better with the current API requirements it imposes. In particular oslog strongly benefits from having static log format strings, which are incompatible with the structured log metadata spelling that swift-log uses. A macro-based spelling that matches the two together can work, but only by hitting the lowest common denominator of the two APIs. Generally, that means not using swift-log as the abstraction, but aiming at oslog as the abstraction instead, probably with macros to reduce the duplication. Macros would be necessary to get the best of oslog. |
Just a small clarification the package is Another approach is to use the pitched package traits if they get accepted. This would allow to conditionally depend on |
There are several places where we log with
os.Logger
. However theos
module is only available on Darwin platforms. We should figure out the story for logging.The text was updated successfully, but these errors were encountered: