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;
    }