Skip to content

woody-labs/middleware-logs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Middleware Logs

This middleware logs requests.

Implementation

It is highly suggested to include monolog/monolog in your project.

// @todo: generate request

// Initialize logger.
$logHandler = new ErrorLogHandler();
$memoryUsageProcessor = new MemoryUsageProcessor(true, false);
$logger = new Logger('http', [$logHandler], [$memoryUsageProcessor]);

// Dispatch request into middleware stack.
$dispatcher = new Dispatcher();
$dispatcher->pipe(new CorrelationIdMiddleware());
$dispatcher->pipe(new LogsMiddleware($logger));
$dispatcher->pipe(new ExceptionMiddleware());
$dispatcher->pipe(new MyAppMiddleware());

// @todo: add other middleware

$response = $dispatcher->handle($request);

About

Middleware PSR-15 compliant which handle Logs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages