Move the logging functionality into the config

Makes the functionality of the logging easier to override. As a result,
it made one less place to rely on catching specific method calls in the
mocked object in tests.