private function clearErrorsHelper(&$log, $clear = true)
    {
        $errorsNotCleared = array();
        foreach ($log as $k => $entry) {
            if (!\in_array($entry[0], array('error','warn'))) {
                continue;
            }
            $clear2 = $clear;
            if ($this->channelName) {
                $channel = isset($entry[2]['channel']) ? $entry[2]['channel'] : null;
                $clear2 = $clear && $channel === $this->channelName;
            }
            if ($clear2) {
                unset($log[$k]);
            } elseif (isset($entry[2]['errorHash'])) {
                $errorsNotCleared[] = $entry[2]['errorHash'];
            }
        }
        $log = \array_values($log);
        return $errorsNotCleared;
    }