make sure headers is set prior to accessing
make PSR2 compliant
Merge pull request #609 from PeerJ/FixLoggerWithNullTransport

make sure headers is set prior to accessing