woody / middleware-logs
Middleware PSR-15 compliant which handle Logs
dev-master
2019-01-11 19:36 UTC
Requires
- php: ^7.1
- psr/log: ^1.1
- woody/http-server-middleware: dev-master
Suggests
- monolog/monolog: Add monolog support for advanced log integration
This package is auto-updated.
Last update: 2024-11-12 09:10:19 UTC
README
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);