Added support for capturing logs

And changed the test to validate correct logging