PHP Class Psr7Middlewares\Middleware\AccessLog

Mostrar archivo Open project: oscarotero/psr7-middlewares

Public Methods

Method Description
__construct ( Psr\Log\LoggerInterface $logger ) Set the LoggerInterface instance.
__invoke ( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $next ) : Psr\Http\Message\ResponseInterface Execute the middleware.
combined ( boolean $combined = true ) : self Whether use the combined log format instead the common log format.

Private Methods

Method Description
combinedFormat ( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response ) : string Generates a message using the Apache's Combined Log format This is exactly the same than Common Log, with the addition of two more fields: Referer and User-Agent headers.
commonFormat ( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response ) : string Generates a message using the Apache's Common Log format https://httpd.apache.org/docs/2.4/logs.html#accesslog.

Method Details

__construct() public method

Set the LoggerInterface instance.
public __construct ( Psr\Log\LoggerInterface $logger )
$logger Psr\Log\LoggerInterface

__invoke() public method

Execute the middleware.
public __invoke ( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $next ) : Psr\Http\Message\ResponseInterface
$request Psr\Http\Message\ServerRequestInterface
$response Psr\Http\Message\ResponseInterface
$next callable
return Psr\Http\Message\ResponseInterface

combined() public method

Whether use the combined log format instead the common log format.
public combined ( boolean $combined = true ) : self
$combined boolean
return self