Download the PHP package dmeys/request-logger without Composer
On this page you can find all versions of the php package dmeys/request-logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package request-logger
Log request and response
This package adds a middleware which can log incoming requests and responses. You can see the logs in view panel
at https://your.domain/request-logs
Laravel Installation
You can install the package via composer:
You must publish the asset files with:
You must publish the config file and assets with:
request-logger.php
You have to execute migrations with:
This packages provides a middleware which can be added as a global middleware or as a single route.
Supported drivers
- storage logs
- database (mysql)
Lumen Installation
You can install the package via composer:
You must install vendor:publish plugin
You must register provider:
You must publish the config file and assets with:
This is the contents of the published config file:
request-logger.php
You must register this config file:
You must execute migrations with:
You must create storage symbolic link with:
You must register middleware:
This packages provides a middleware which can be added as a global middleware or as a single route.
Data Pruning
Without pruning, the request_logs
table can accumulate records very quickly.
To mitigate this, you should schedule the request-logs:clear
artisan command to run daily:
Running the php artisan request-logs:clear
command deletes
recorded logs older than the number of days specified in the log_keep_days
configuration.
To delete all logs, add the "--all" parameter php artisan request-logs:clear --all
Configuration custom fields
The Request Logger allows you to add custom fields for logging.
The package provides the configureRequestLoggerCustomFields
function, which must return an array containing the custom
fields.
Additionally, make sure to add these custom fields to the database table request_logs
.
Here's an example of using configureRequestLoggerCustomFields()
:
- Add the middleware
ConfigureRequestLoggerMiddleware
. -
In the middleware, implement the
handle
method and specify custom fields using theconfigureRequestLoggerCustomFields
function. - Register the middleware in the Http Kernel.
These steps outline how to use the configureRequestLoggerCustomFields
function to add custom fields to your logging
setup.