Sets a logger for each error level.

@param array $loggers Error levels to [LoggerInterface|null, LogLevel::*] map

@return array The previous map

@throws \InvalidArgumentException
976417
public function setLoggers(array $loggers)
    {
        $prevLogged = $this->loggedErrors;
        $prev = $this->loggers;
        $flush = [];

        foreach ($loggers as $type => $log) {
            if (!isset($prev[$type])) {
                throw new \InvalidArgumentException('Unknown error type: '.$type);
            }
            if (!\is_array($log)) {
                $log = [$log];
            } elseif (!\array_key_exists(0, $log)) {
                throw new \InvalidArgumentException('No logger provided');
            }
            if (null === $log[0]) {
                $this->loggedErrors &= ~$type;
            } elseif ($log[0] instanceof LoggerInterface) {
                $this->loggedErrors |= $type;
            } else {
                throw new \InvalidArgumentException('Invalid logger provided');
            }
            $this->loggers[$type] = $log + $prev[$type];

            if ($this->bootstrappingLogger && $prev[$type][0] === $this->bootstrappingLogger) {
                $flush[$type] = $type;
            }
        }
        $this->reRegister($prevLogged | $this->thrownErrors);

        if ($flush) {
            foreach ($this->bootstrappingLogger->cleanLogs() as $log) {
                $type = $log[2]['exception'] instanceof \ErrorException ? $log[2]['exception']->getSeverity() : E_ERROR;
                if (!isset($flush[$type])) {
                    $this->bootstrappingLogger->log($log[0], $log[1], $log[2]);
                } elseif ($this->loggers[$type][0]) {
                    $this->loggers[$type][0]->log($this->loggers[$type][1], $log[1], $log[2]);
                }
            }
        }

        return $prev;
    }
512790
public function setErrors($errors)
    {
        $this->errors = strtolower((string) $errors);

        $message = sprintf("Set errors flag to [%s].", $this->errors);
        $this->log($message, Project::MSG_DEBUG);
    }
354583
public static function getLogger($loggerType, $loggerParams = array()) {
        //trap all possible exceptions and throw LoggerException
        try {
            switch ($loggerType) {
                case LOGGER_STDERR:
                    return self::_getLoggerStderr();
                case LOGGER_LEVEL1:
                    return self::_getLoggerLevel1($loggerParams);
                case LOGGER_LEVEL2:
                    return self::_getLoggerLevel2($loggerParams);                
                case LOGGER_LEVEL3:
                    return self::_getLoggerLevel3($loggerParams);              
                case LOGGER_SECURITY:
                    return self::_getLoggerSecurity($loggerParams);
            }            
        } catch (\Exception $logException) {
            throw new LoggerException('Logger caught an exception in '
                . $logException->getTraceAsString() . ':'
                . $logException->getMessage(), 1001);
        }
    }
1224531
public function setLoggerInstance(LoggerInterface $LogInterface = null)
    {
        $this->oLog = $LogInterface ?? new \Psr\Log\NullLogger();

        return $this;
    }
409974
function addLoggers($loggers)
	{
		foreach(func_get_args() as $logger)
		{
			if(is_array($logger))
			{
				foreach($logger as $sublogger)
				{
					$this->addLoggers($sublogger);
				}
			}
			else if(is_object($logger))
			{
				$this->_loggers[] = $logger;
			}
		}

		return $this;
	}
92582
public function setLogger(LoggerInterface $logger)
    {
        $this->v8->logger = $logger;
        $this->v8->executeString(
            'jsHb.log = function(level, message) {
                phpHb.logger.log(level, message)
            }',
            __CLASS__ . '::' . __METHOD__ . '()'
        );
    }
565393
protected function setLoaders(array $loaders)
    {
        $this->loaders = array();
        foreach ($loaders as $type=>$loader) {
            if (!$loader instanceof FormulaLoaderInterface) {
                throw new \InvalidArgumentException("Not a valid formula loader with key '${type}'.");
            }
            $this->setLoader($type, $loader);
        }
    }
878452
public function setValidators($validators = [])
    {
        if (is_array($validators)) {
            $this->validators = $validators;
        } else {
            $this->validators = func_get_args();
            if (count($this->validators) == 1 && is_string($this->validators[0])) {
                $this->validators = explode(',', $this->validators[0]);
            }
        }

        if (in_array('required', $this->validators)) {
            $this->setRequired();
            unset($this->validators[array_search('required', $this->validators)]);
        }


        return $this;

    }
127454
public function setConnectTries($connectTries) {
        $this->connectTries = (int) $connectTries;
        if ($this->connectTries < 1) {
            throw new InvalidArgumentException('connect tries < 1');
        }
        return $this;
    }
791086
public function setLogger(LoggerInterface $logger)
	{
		$this->logger = $logger;

		// Also update the logger on all current gateways in our pool
		foreach ($this->gatewayPool as $gateway) {
			$gateway->setLogger($logger);
		}
	}
1286724
public function setLogger($logger) {
		if(!in_array('Psr\Log\LoggerInterface', class_implements($logger, true))) {
			throw new \InvalidArgumentException('Logger object does not implement Psr\Log\LoggerInterface');
		}
		$this->logger = $logger;
	}
788501
public function addErrors($messages = [])
	{
		// check if messages are an array
		if(! is_array($messages) && ! $messages instanceof MessageProvider)
		{
			$messages = (array) $messages;
		}

		return $this->errors->merge($this->resolveErrorKey($messages));
	}
182184
private function setLogger($logger)
    {
        $psr = 'Psr\\Log\\LoggerInterface';
        if (!is_a($logger, $psr)) {
            throw new InvalidArgumentException(
                sprintf('Expected an instance of %s', $psr)
            );
        }

        $this->logger = $logger;
    }
356538
public function setLogger(GoracashLogger $logger)
    {
        $this->config->setLoggerClass(get_class($logger));
        $this->logger = $logger;
    }
252399
private function validateResolvers(array $resolvers)
    {
        foreach ($resolvers as $index => $resolver) {
            if (!$this->isValidResolver($resolver)) {
                throw new \InvalidArgumentException(sprintf(
                    'Resolver at index %s of type "%s" is not valid resolver type',
                    $index,
                    get_class($resolver)
                ));
            }
        }
    }
1205315
public function createHandlers(array $loggerConfig)
    {
        $handlers         = array();
        $formatterFactory = new MonologCreator\Factory\Formatter(
            $this->_config
        );
        $handlerFactory   = new MonologCreator\Factory\Handler(
            $this->_config,
            $this->_levels,
            $formatterFactory
        );

        foreach ($loggerConfig['handler'] as $handlerType) {
            $handlers[] = $handlerFactory->create(
                $handlerType,
                $loggerConfig['level']
            );
        }

        return $handlers;
    }
334808
public function setLogger(
        \Psr\Log\LoggerInterface $logger = null,
        $messageFormat = \GuzzleHttp\MessageFormatter::CLF
    ) {
        if ($logger === null) {
            $handler = new \Monolog\Handler\ErrorLogHandler(\Monolog\Handler\ErrorLogHandler::SAPI);
            $handler->setFormatter(new \Monolog\Formatter\LineFormatter('%message%'));
            $logger = new \Monolog\Logger('HTTP Log', [$handler]);
        }

        $formatter = new \GuzzleHttp\MessageFormatter($messageFormat);

        $handler = \GuzzleHttp\Middleware::log($logger, $formatter);
        $this->logger = $handler;

        $handlerStack = $this->getConfig('handler');
        $this->setLogHandler($handlerStack, $handler);

        return $this;
    }