Reusing some of the writer logic from MD\Foundation\LogLevels class and Psr\Log\AbstractLogger.