New swift-log testing LogHandler

It is designed to capture and format log messages for use in assertions and is available here.

3 Likes

The Readme doesn't really say or show what it does. Could you elaborate, or enhance the Readme with sample usage maybe?

Always great to have new LogHandlers! Thx!

Very nice work @neallester! :-)

I use such approach as well often when the logs are expected to be the "UI" that others look at -- i.e. a library and I want to ensure good logs :+1: Nice to see a LogHandler in OSS implementing this pattern nicely.

Would you want to PR to apple/swift-log and include it in the list of suggested handler impls? (Something like that: https://github.com/apple/swift-log/commit/e5a4bd1003dcbbb04fc6deec91995d39b0e35f87 with an one-liner about what the lib does).

@tkrajacic there's examples linked to from the main README, I think that's good enough :slight_smile: https://github.com/neallester/swift-log-testing/blob/master/Tests/SwiftLogTestingTests/ExampleTests.swift Short story being: allowing to capture logs and assert if they were the ones you'd have expected etc.


edit: I made a ticket as a reminder so we don't forget about it :slight_smile: https://github.com/apple/swift-log/issues/105

2 Likes

Sample code showing usage is available here: https://github.com/neallester/swift-log-testing/blob/master/Tests/SwiftLogTestingTests/ExampleTests.swift

Yes: https://github.com/apple/swift-log/pull/106

1 Like
Terms of Service

Privacy Policy

Cookie Policy