src/Log/AggregateLogger.php
public function addLogger(LoggerInterface $logger, $level = null, $key = null) {
        // Make a small attempt to prevent infinite cycles by disallowing all logger chaining.
        if ($logger instanceof AggregateLogger) {
            throw new \InvalidArgumentException("You cannot chain AggregateLoggers.", 500);
        }

        $level = $level ?? self::DEBUG;
        $key = $key ?? spl_object_hash($logger);
        $this->loggers[$key] = [
            'logger'    => $logger,
            'priority'  => static::levelPriority($level),
            'key'       => $key,
            'enabled'   => true
        ];
        return $this;
    }
public function addLogger(LoggerInterface $logger, $level = null, $key = null) {
        // Make a small attempt to prevent infinite cycles by disallowing all logger chaining.
        if ($logger instanceof AggregateLogger) {
            throw new \InvalidArgumentException("You cannot chain AggregateLoggers.", 500);
        }

        $level = $level ?? self::DEBUG;
        $key = $key ?? spl_object_hash($logger);
        $this->loggers[$key] = [
            'logger'    => $logger,
            'priority'  => static::levelPriority($level),
            'key'       => $key,
            'enabled'   => true
        ];
        return $this;
    }
public function addLogger ( LoggerInterface $ logger , $ level = null , $ key = null ) { // Make a small attempt to prevent infinite cycles by disallowing all logger chaining. if ( $ logger instanceof AggregateLogger ) { throw new \ InvalidArgumentException ( "You cannot chain AggregateLoggers." , 500 ) ; } $ level = $ level ?? self :: DEBUG ; $ key = $ key ?? spl_object_hash ( $ logger ) ; $ this -> loggers [ $ key ] = [ 'logger' => $ logger , 'priority' => static :: levelPriority ( $ level ) , 'key' => $ key , 'enabled' => true ] ; return $ this ; }
Add a new logger to observe messages.

@param LoggerInterface $logger
@param string $level
@return AggregateLogger
Add a new logger to observe messages .