protected function getStreamHandler(FormatterInterface $formatter, $stream, $level = Logger::DEBUG, $bubble = true)
    {
        // Unless cli, force output to php://output
        $stream = Director::is_cli() ? $stream : 'php://output';
        $handler = Injector::inst()->createWithArgs(
            StreamHandler::class,
            array($stream, $level, $bubble)
        );
        $handler->setFormatter($formatter);
        return $handler;
    }