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: add vapor/console-kit backend to README (#95) · apple/swift-log@e5a4bd1 · GitHub 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: swift-log-testing/ExampleTests.swift at master · neallester/swift-log-testing · GitHub 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: Outreach: Ensure to include neallester/swift-log-testing in the libs list · Issue #105 · apple/swift-log · GitHub

2 Likes

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

Yes: Reformatted backend list as a table and add swift-log-testing by neallester · Pull Request #106 · apple/swift-log · GitHub

1 Like