PHP code example of rtheunissen / guzzle-log-middleware

1. Go to this page and download the library: Download rtheunissen/guzzle-log-middleware library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rtheunissen / guzzle-log-middleware example snippets


$middleware = new Logger($logger);

$middleware = new Logger(function ($level, $message, array $context) {
    // Log the message
});

use Psr\Log\LogLevel;

$middleware->setLogLevel(LogLevel::DEBUG);

$middleware->setLogLevel(function ($response) {
    // Return log level
});

$middleware->setFormatter($formatter);

$middleware->setFormatter(function ($request, $response, $reason) {
    // Return log message
});

$middleware = new Logger($logger, $formatter);