Avoid calling expensive methods before checking if we need to

There’s no need to create the full $record structure before checking for handlers. This can be called inside a loop, and Datetime::createFromFormat() is very expensive.
I see, I would recommend fixing the test though, you can add a 
NullHandler to the logger for example to have something that handles all 
messages.