Set a PSR-3 compatible logger (or use monolog by default)

@param \Psr\Log\LoggerInterface $logger
@param string $messageFormat Message format
@return $this
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;
    }
417327
public function logger($logger = null)
    {
        if ($logger) {
            $this->_logger = $logger;
        }

        if ($this->_logger) {
            return $this->_logger;
        }

        $this->_logger = new QueryLogger();
        return $this->_logger;
    }
759700
public function setLogger(string $id, LoggerInterface $logger): self
    {
        $this->_loggers[$id] = $logger;

        return $this;
    }
1215687
public function addLogger($logger, $format = 'CLF')
    {
        if (defined('GuzzleHttp\Subscriber\Log\Formatter::'.$format)) {
            $format = constant('GuzzleHttp\Subscriber\Log\Formatter::'.$format);
        }

        $subscriber = new LogSubscriber($logger, $format);
        $this->guzzleClient->getEmitter()->attach($subscriber);
    }
216267
public function purgeAllQueues(LoggerInterface $logger)
    {
        foreach ($this->queueInfo->getQueues()->getRabbitMqQueues() as $rabbitMqQueueTransfer) {
            $this->queueAdapter->purgeQueue($rabbitMqQueueTransfer->getName());
            $logger->info(sprintf('Purge queue "%s" request send.', $rabbitMqQueueTransfer->getName()));
        }

        return true;
    }
433704
private function applyDecorators(LoggerInterface $logger, array $config)
    {
        foreach ($this->decorators as $configKey => $decoratorClassName) {
            if (!isset($config[$configKey])) {
                continue;
            }
            if (!class_exists($decoratorClassName)) {
                throw new \RuntimeException('Decorator class not found: ' . $decoratorClassName);
            }
            if (!is_subclass_of($decoratorClassName, '\Phlib\Logger\Decorator\AbstractDecorator')) {
                throw new \RuntimeException('Decorator class invalid: ' . $decoratorClassName);
            }
            /** @var \Phlib\Logger\Decorator\AbstractDecorator $logger */
            $logger = new $decoratorClassName($logger, $config[$configKey]);
        }

        return $logger;
    }
13731
public function setMessageArg($messageArg)
    {

        $messageArg = (array) $messageArg;

        /**
         * Check on empty argument and check if
         * passed argument is not equal to existence
         */
        if (empty($messageArg)
            || $this->getData(self::P_MESSAGE_ARG) === $messageArg
        ) {
            return null;
        }

        $formattedMessage = vsprintf($this->message, $messageArg);

        if ($formattedMessage === $this->message) {
            // there are no any %s so we just append params
            $formattedMessage = ' [' . implode('] [', $messageArg) . ']';
        }
        $this->message = $formattedMessage;

        $this->data[self::P_MESSAGE_ARG] = $messageArg;

        return $this;
    }
107718
public static function log($msg, $logLevel = X_LOG_DEBUG) {
        /** @var Logger $logger */
        $logger = ComponentFactory::getComponent('logger');
        $logger->log($msg, $logLevel, 2);
    }
1086779
public function setLogger($logger = null)
    {
        if (!isset($logger)) {
            $logger = new \WebPConvert\Loggers\VoidLogger();
        }
        $this->logger = $logger;
    }
848065
public function log( \Monolog\Logger $logger) {
        $reflection = new \ReflectionClass($this);
        $logger->error($this->getMessage(), [
            'type' => $reflection->getShortName(),
            'code' => $this->getCode(),
            'line' => $this->getLine(),
            'file' => $this->getFile(),
            'trace' => $this->getTrace(),
            'context' => $this->getContext()
        ]);
    }
941526
public function addFormatter(SymbolFormatterInterface $formatter)
    {
        if ($formatter instanceof self) {
            // Reducing recursivity
            $this->addFormatters($formatter->formatters);
        } else {
            $this->formatters[] = $formatter;
        }

        return $this;
    }
1275214
public function setLogger(LoggerInterface $logger)
    {
        $this->traitSetLogger($logger);
        foreach ($this->connections as $connection) {
            $connection->setLogger($logger);
        }
    }
328998
protected function buildQueryCallback(LogManager $logger): callable
    {
        return function (QueryExecuted $query) use ($logger) {
            $sql = Str::replaceArray('?', $query->connection->prepareBindings($query->bindings), $query->sql);

            $logger->info("<comment>{$sql} [{$query->time}ms]</comment>");
        };
    }
852356
public function setFormatter(Formatter $formatter)
    {
        $this->output->setFormatter($formatter);
        $this->errorOutput->setFormatter($formatter);
    }
674684
public final function setLogger( ?LoggerInterface $logger )
   {

      $this->_options[ 'logger' ] = null === $logger ? new NullLogger() : $logger;

      unset( $this->_options[ 'data' ] );

      return $this;

   }
1335361
protected function logLine($messageType, $messageText)
    {
        switch ($messageType) {
            case Process::ERR:
                $typeStr = "[Error]";
                break;
            default:
                $typeStr = "";
                break;
        }

        echo sprintf("\n%s %s\n", $typeStr, $messageText);
    }
847547
protected function pushHandler($handler, $formatter = true)
    {
        if ($formatter == false) {
            return $this->monolog->pushHandler($handler);
        }

        $this->monolog->pushHandler($handler);
        $handler->setFormatter($this->getDefaultFormatter());

        return $this;
    }