Enable debug mode
Guzzle will print all request and response on screen
@param $logPath
@return $this
492474
public function debug($logPath)
    {
        $adapter = $this->getAdapter();
        $adapter->getEmitter()->attach(new LogSubscriber($logPath, Formatter::DEBUG));
        return $this;
    }
896774
public function setDebugMode($value): self
    {
        if (is_string($value) || is_array($value)) {
            $value = static::detectDebugMode($value);
        } elseif (!is_bool($value)) {
            throw new InvalidArgumentException(sprintf('Value must be either a string, array, or boolean, %s given.', gettype($value)));
        }
        $this->parameters['debugMode'] = $value;
        return $this;
    }
439080
public function debug($allDetails = false)
    {
        $className = get_class($this);
        $msg = "{$className} ({$this->getHttpCode()}) {$this->request->getMethod()}={$this->getUrl()} IN {$this->getTotalTime()}s";

        if ($allDetails) {
            if ($this->headersText != null) {
                $msg .= " with response HEADERS:\n";
                foreach (explode("\n", $this->headersText) as $line) {
                    $msg .= "\t{$line}\n";
                }
            } else {
                $msg .= "\n";
            }

            $body = $this->getBody();
            if (mb_strlen($body, Application::getEncoding()) > 255) {
                $body = mb_substr($body, 0, 252, Application::getEncoding()) . '...';
            }

            $msg .= "\n";
            $msg .= "RESPONSE BODY:----------------------------\n";
            $msg .= $body . "\n";
            $msg .= '------------------------------------------';
        }

        return $msg;
    }
959116
public function debug($message = true, array $context = [])
    {
        // using this to switch on/off the debug for this object
        if (is_bool($message)) {
            $this->debug = $message;

            return $this;
        }

        // if debug is enabled, then log it
        if ($this->debug) {
            if (!isset($this->app) || !isset($this->app->logger) || !$this->app->logger instanceof \Psr\Log\LoggerInterface) {
                $message = '['.get_class($this).']: '.$message;
            }
            $this->log(LogLevel::DEBUG, $message, $context);
        }

        return $this;
    }
1037141
public function initLogging(array $log_paths): self
    {
        foreach ($log_paths as $logger => $logfile) {
            ('debug' === $logger) && TelegramLog::initDebugLog($logfile);
            ('error' === $logger) && TelegramLog::initErrorLog($logfile);
            ('update' === $logger) && TelegramLog::initUpdateLog($logfile);
        }

        return $this;
    }
915119
public function setLogLevel($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Debugger\V2\Breakpoint_LogLevel::class);
        $this->log_level = $var;

        return $this;
    }
20222
public final function useLogger(string $includePath): ApplicationInterface
    {
        if (!is_dir($includePath)) {
            throw new InvalidArgumentException(
                "Can't use logger: expect \""
                . $includePath . "\" to be a directory"
            );
        }
        $this->logDirectory = $includePath;
        return $this;
    }
438535
public static void openLogFile(String logPath) {
		if (logPath == null) {
			printStream = System.out;
		} else {
			try {
				printStream = new PrintStream(new File(logPath));
			} catch (FileNotFoundException e) {
				throw new IllegalArgumentException("Log file " + logPath + " was not found", e);
			}
		}
	}
1052260
public function debugLog($log)
    {
        if (defined('DEBUG_MODE') and DEBUG_MODE == 1) {
            $log = 'DEBUG >>> ' . $log;
            echo $log . PHP_EOL . PHP_EOL;
        }

        return $this;
    }
745032
public static function setupFromFile($filePath) {

        $loggers = null;

        require($filePath);

        if (!isset($loggers)) {
            throw new LoggerManagerException('The configuration file [' . $filePath . '] must define a variable $loggers');
        }

        if (!is_array($loggers)) {
            throw new LoggerManagerException('The configuration file [' . $filePath . '] must define a variable $loggers as an array');
        }

        self::setupFromArray($loggers);
    }
321078
def enable_debug_logging=(enable)
      return if enable.nil?
      logging = REXML::XPath.first(@xml, 'ScanTemplate/Logging')
      if logging.nil?
        logging = REXML::Element.new('Logging')
        @xml.add_element(logging)
      end
      debug_logging = REXML::XPath.first(logging, 'debugLogging')
      if debug_logging.nil?
        debug_logging = REXML::Element.new('debugLogging')
        logging.add_element(debug_logging)
      end
      debug_logging.attributes['enabled'] = (enable ? 1 : 0)
    end
305618
public static function search($query, ConsoleLogger $logger = null)
    {
        $handler = \GuzzleHttp\HandlerStack::create();
        if (isset($logger)) {
            $handler->push(\GuzzleHttp\Middleware::log(
                $logger,
                new \GuzzleHttp\MessageFormatter('{req_headers}'.PHP_EOL.'{req_body}')
            ));
        }
        self::$client = new \GuzzleHttp\Client(['cookies' => true, 'handler' => $handler]);
        self::$client->request(
            'GET',
            self::BASEURL.'services/entreprise/rest/recherche/parPhrase',
            [
                'query' => [
                    'phrase'                => $query,
                    'typeProduitMisEnAvant' => 'EXTRAIT',
                ],
            ]
        );

        self::$client->request(
            'GET',
            self::BASEURL.'societes/recherche-entreprise-dirigeants/'.
            'resultats-entreprise-dirigeants.html'
        );
        $response = self::$client->request(
            'GET',
            'https://www.infogreffe.fr/services/entreprise/rest/recherche/'.
            'derniereRechercheEntreprise'
        );
        $response = json_decode($response->getBody());
        $idsRCS = $idsNoRCS = $idsRemovedRCS = [];
        foreach ($response->entrepRCSStoreResponse->items as $result) {
            if (isset($result->id)) {
                $idsRCS[] = $result->id;
            }
        }
        if (isset($response->entrepRadieeStoreResponse)) {
            foreach ($response->entrepRadieeStoreResponse->items as $result) {
                if (isset($result->id)) {
                    $idsRemovedRCS[] = $result->id;
                }
            }
        }
        foreach ($response->entrepHorsRCSStoreResponse->items as $result) {
            if (isset($result->id)) {
                $idsNoRCS[] = $result->id;
            }
        }
        $items = [];
        if (!empty($idsRCS)) {
            $items = array_merge($items, self::getItems($idsRCS, 'ENTREP_RCS_ACTIF'));
        }
        if (!empty($idsRemovedRCS)) {
            $items = array_merge($items, self::getItems($idsRemovedRCS, 'ENTREP_RCS_RADIES'));
        }
        if (!empty($idsNoRCS)) {
            $items = array_merge($items, self::getItems($idsNoRCS, 'ENTREP_HORS_RCS'));
        }

        return self::getArrayFromJSON($items);
    }
727106
public function setCachePath($cachePath)
    {
        if (empty($cachePath) || !is_writable($cachePath)) {
            throw new PageCacheException(__METHOD__.' - Cache path not writable: '.$cachePath);
        }
        if (substr($cachePath, -1) !== '/') {
            throw new PageCacheException(__METHOD__.' - / trailing slash is expected at the end of cache_path.');
        }
        $this->cachePath = $cachePath;
        return $this;
    }
810122
public function setLogFilePath($logFilePath)
    {
        if (!$this->isParentDirectoryExists($logFilePath)) {
            throw new PageCacheException('Log file directory does not exist for the path provided '
                . $logFilePath);
        }

        $this->logFilePath = $logFilePath;
        return $this;
    }
969986
public function printDebug()
    {
        if(($this->xResponse))
        {
            foreach($this->aDebugMessages as $sMessage)
            {
                $this->xResponse->debug($sMessage);
            }
            $this->aDebugMessages = [];
        }
    }
298308
protected function _setupLogging($loglevel)
    {
        // Backwards compatibility
        if (file_exists(JPATH_LIBRARIES . '/src/Log/Log.php')) {
          require_once JPATH_LIBRARIES . '/src/Log/Log.php';
        } else {
          require_once JPATH_LIBRARIES . '/joomla/log/log.php';
        }

        if ($loglevel == OutputInterface::VERBOSITY_NORMAL) {
            return;
        }

        switch ($loglevel)
        {
            case OutputInterface::VERBOSITY_DEBUG:
                $priority = JLog::ALL;
                break;
            case OutputInterface::VERBOSITY_VERY_VERBOSE:
                $priority = JLog::ALL & ~JLog::DEBUG;
                break;
            case OutputInterface::VERBOSITY_VERBOSE:
                $priority = JLog::ALL & ~JLog::DEBUG & ~JLog::INFO & ~JLog::NOTICE;
                break;
        }

        if ($this->_is_platform === true || version_compare(JVERSION, '3.0.0', '>='))
        {
            $callback = function ($entry) {
                $priorities = array(
                    JLog::EMERGENCY => 'EMERGENCY',
                    JLog::ALERT => 'ALERT',
                    JLog::CRITICAL => 'CRITICAL',
                    JLog::ERROR => 'ERROR',
                    JLog::WARNING => 'WARNING',
                    JLog::NOTICE => 'NOTICE',
                    JLog::INFO => 'INFO',
                    JLog::DEBUG => 'DEBUG'
                );

                $message = $priorities[$entry->priority] . ': ' . $entry->message . (empty($entry->category) ? '' : ' [' . $entry->category . ']') . "\n";

                fwrite(STDERR, $message);
            };

            $options = array('logger' => 'callback', 'callback' => $callback);
        }
        else
        {
            require_once dirname(__DIR__) . '/Joomla/Legacy/JLoggerStderr.php';

            $options = array('logger' => 'stderr');
        }


        JLog::addLogger($options, $priority);
    }
1267251
public static function getOrCreateFileLogger(string $category, string $logfilePath): LoggerInterface
    {
        $hash = sha1($category . $logfilePath);

        if (!isset(self::$instance[$hash])) {
            $logger = new Logger($category);
            $logger->pushHandler(new StreamHandler($logfilePath, Logger::DEBUG));

            self::$instance[$hash] = $logger;
        }

        return self::$instance[$hash];
    }