public function log($level, $message, array $context = [])
    {
        static $counter = [];

        !$this->logger || $this->logger->log($level, $message, $context);

        // If message is exception convert it to string
        $message = is_object($message) ? $message->__toString() : $message;
        // Group identical messages with add suffix number
        if (isset($this->messages[$level][$hash = md5($message)])) {
            $this->messages[$level][$hash] = '(' . ++$counter[$hash] . ') ' . $message;
        } else {
            $counter[$hash] = 1;
            $this->messages[$level][$hash] = $message;
        }
    }