prettus / laravel-request-logger
HTTP request logger middleware for Laravel
Installs: 44 515
Dependents: 1
Suggesters: 0
Security: 0
Stars: 242
Watchers: 10
Forks: 57
Open Issues: 17
Requires
- php: >=5.4.0
- illuminate/http: ~5.0
- illuminate/support: ~5.0
- monolog/monolog: ~1.11
Requires (Dev)
- laravel/framework: ~5.0
This package is auto-updated.
Last update: 2024-11-04 08:33:35 UTC
README
Request and Response Logger for Laravel
Insiperd by Morgan - Node HTTP request logger
Installation
Composer
Add prettus/laravel-request-logger
to the "require" section of your composer.json
file.
"prettus/laravel-request-logger": "1.2.*"
Run composer update
to get the latest version of the package.
or
Run composer require prettus/laravel-request-logger
direct in your terminal
Laravel
In your config/app.php
add Prettus\RequestLogger\Providers\LoggerServiceProvider::class
to the end of the providers
array:
'providers' => array( ..., Prettus\RequestLogger\Providers\LoggerServiceProvider::class, ),
Publish Configuration
php artisan vendor:publish --provider="Prettus\RequestLogger\Providers\LoggerServiceProvider"
Configuration
In your config/request-logger.php
file, you can change configuration for logger
'logger' => [ 'enabled' => true, 'handlers' => ['Prettus\RequestLogger\Handler\HttpLoggerHandler'], 'file' => storage_path("logs/http.log"), 'level' => 'info', 'format' => 'common' ]
Format Interpolation
Variables
Default formats
Examples
{method} {full-url}
[2015-04-03 00:00:00] local.INFO: GET http://prettus.local/user/1?param=lorem ["REQUEST"]
{method} {full-url} {remote-addr} {port}
[2015-04-03 00:00:00] local.INFO: GET http://prettus.local/user/1?param=lorem 192.168.10.1 80 ["REQUEST"]
{method} {root} {url} {full-url} {path} {decoded-path} {remote-addr} {format} {scheme} {port} {query-string}
[2015-04-03 00:00:00] local.INFO: GET http://prettus.local http://prettus.local/user/1 http://prettus.local/user/1?param=lorem user/1 user/1 192.168.10.1 html http 80 param=lorem ["REQUEST"]
[{status}] HTTP:{http-version} {content}
[2015-04-03 00:00:00] local.INFO: [200] HTTP:1.1 {"id":1,"name":"Anderson Andrade", "email":"contato@andersonandra.de"} ["RESPONSE"]