-
Notifications
You must be signed in to change notification settings - Fork 301
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
Add SwiftLogNoOpLogHandler.init(_: String)
#194
Conversation
Motivation: `LogHandler` facotories are given a label as input and return a `LogHandler`. Since the no-op handler doesn't care about the label callers must provide a thunk: `{ _ in SwiftLogNoOpLogHandler() }`. That's fine but slightly more annoying to type than it needs to be. Modifications: - Add `SwiftLogNoOpLogHandler.init(_: String)` Result: Users can create a logger with the no-op handler with: ```swift Logger(label: "foo", factory: SwiftLogNoOpLogHandler.init) ``` instead of: ```swift Logger(label: "foo", factory: { _ in SwiftLogNoOpLogHandler() }) ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, makes sense to me -- happy to add 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense, thank you!
Do people mind doing this on in 1.4.3 or should we 1.5.0? Technically it's new API |
Let's do 1.5.0, we don't need to release 1.4.3 at all. |
+1 for 1.5.0, version numbers are cheap! |
Cool, I can cut that tomorrow morning, unless you're in a rush (feel free to do the tags and milestones dance today if in a rush) :-) |
No rush at all, this was just an itch I needed to scratch. |
Motivation:
LogHandler
facotories are given a label as input and return aLogHandler
. Since the no-op handler doesn't care about the labelcallers must provide a thunk:
{ _ in SwiftLogNoOpLogHandler() }
.That's fine but slightly more annoying to type than it needs to be.
Modifications:
SwiftLogNoOpLogHandler.init(_: String)
Result:
Users can create a logger with the no-op handler with:
instead of: