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;
        }
    }
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;
        }
    }
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 ; } }
Wrapper upon logger.

This method write all messages in file if logger is passed and also collect them in memory
for following process at the end of execution.
All not "info" messages are grouped with number of repeats prefix.

Each next "run" resets "messages" that is why you should process this information after each execution.

@param string $level
@param string $message
@param array $context
Wrapper upon logger .