2017 © Pedro Peláez
 

library laravel-request-logger

HTTP request logger middleware for Laravel

image

timeout2x/laravel-request-logger

HTTP request logger middleware for Laravel

  • Monday, April 10, 2017
  • by timeout2x
  • Repository
  • 1 Watchers
  • 2 Stars
  • 468 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 48 Forks
  • 0 Open issues
  • 8 Versions
  • 16 % Grown

The README.md

Laravel Request Logger

Request and Response Logger for Laravel, (*1)

Insiperd by Morgan - Node HTTP request logger, (*2)

Latest Stable Version Total Downloads Latest Unstable Version License Analytics, (*3)

Installation

Composer

Add timeout2x/laravel-request-logger to the "require" section of your composer.json file., (*4)

``` bash composer require timeout2x/laravel-request-logger, (*5)


Run `composer update` to get the latest version of the package. ### Laravel In your `config/app.php` add `'Prettus\RequestLogger\Providers\LoggerServiceProvider'` to the end of the `providers` array: ```php 'providers' => array( ..., 'Prettus\RequestLogger\Providers\LoggerServiceProvider', ),

Publish Configuration, (*6)

php artisan vendor:publish --provider="Prettus\RequestLogger\Providers\LoggerServiceProvider"

Configuration

In your config/request-logger.php file, you can change configuration for logger, (*7)

'logger' => [
    'enabled'   => true,
    'handlers'  => ['Prettus\RequestLogger\Handler\HttpLoggerHandler'],
    'file'      => storage_path("logs/http.log"),
    'level'     => 'info',
    'format'    => 'common'
],
'exclude' => [],
Property Type Default Value Description
enabled boolean true Enable or disable log http
handlers array ['Prettus\RequestLogger\Handler\HttpLoggerHandler'] Instance of the Monolog\Handler\HandlerInterface. (See more)[https://github.com/Seldaek/monolog#handlers]
file string storage_path("logs/http.log") If you are using Prettus\RequestLogger\Handler\HttpLoggerHandler, you can set the file will be saved walk logs
level string info Level logger write: [notice, info, debug, emergency, alert, critical, error, warning]
format string common Format for the log record

Format Interpolation

Variables

Format Description Exemple
{method} Get the request method. PUT
{root} Get the root URL for the application. http://prettus.local
{url} Get the URL (no query string) for the request. http://prettus.local/users
{full-url} Get the full URL for the request. http://prettus.local/users?search=lorem
{path} Get the current path info for the request. /users
{decoded-path} Get the current encoded path info for the request. /users
{remote-addr} Returns the client IP address. 192.168.10.1
{format} Gets the format associated with the mime type. html
{scheme} Gets the request's scheme. http
{port} Returns the port on which the request is made. 80
{query-string} Generates the normalized query string for the Request. ?search=lorem
{remote-user} Returns the user.
{referer} The page address (if any) by which the user agent to the current page
{user-agent} Get user agent Mozilla/5.0 (Windows NT 6.3; WOW64)
{date} Current Date 2015-04-05 14:00:00
{content} Get the response content. {json:response}
{request-content} Get the request content if it exists. {json:response}
{content-length} Get the content length in bytes 4863
{response-time} Response time in ms 231
{status} Http status code 200
{http-version} Http protocol version 1.1
{server[KEY]} $_SERVER Server and execution environment information (See more)[http://php.net/manual/reserved.variables.server.php]
{req[HEADER]} Request Header values
{res[HEADER]} Response Header values

Default formats

Name Format
combined {remote-addr} - {remote-user} [{date}] "{method} {url} HTTP/{http-version}" {status} {content-length} "{referer}" "{user-agent}"
common {remote-addr} - {remote-user} [{date}] "{method} {url} HTTP/{http-version}" {status} {content-length}
dev {method} {url} {status} {response-time} ms - {content-length}
short {remote-addr} {remote-user} {method} {url} HTTP/{http-version} {status} {content-length} - {response-time} ms
tiny {method} {url} {status} {content-length} - {response-time} ms

Examples

{method} {full-url}, (*8)

[2015-04-03 00:00:00] local.INFO: GET http://prettus.local/user/1?param=lorem ["REQUEST"]

{method} {full-url} {remote-addr} {port}, (*9)

[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}, (*10)

[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}, (*11)

[2015-04-03 00:00:00] local.INFO: [200] HTTP:1.1 {"id":1,"name":"Anderson Andrade", "email":"contato@andersonandra.de"} ["RESPONSE"]

The Versions

10/04 2017

dev-master

9999999-dev https://github.com/timeout2x/laravel-request-logger

HTTP request logger middleware for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

The Development Requires

by Joey Hallie

laravel logger request response

10/04 2017

1.3

1.3.0.0 https://github.com/timeout2x/laravel-request-logger

HTTP request logger middleware for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

The Development Requires

by Joey Hallie

laravel logger request response

10/04 2017

1.2

1.2.0.0 https://github.com/timeout2x/laravel-request-logger

HTTP request logger middleware for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

The Development Requires

by Joey Hallie

laravel logger request response

23/01 2017

1.1.0

1.1.0.0 https://github.com/iamjoey/laravel-request-logger

HTTP request logger middleware for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

The Development Requires

by Joey Hallie

laravel logger request response

23/01 2017

1.0.2

1.0.2.0

HTTP request logger middleware for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

laravel logger request response

29/01 2016

1.0.1

1.0.1.0

HTTP request logger middleware for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

laravel logger request response

24/12 2015

dev-develop

dev-develop

HTTP request logger middleware for Laravel

  Sources   Download

MIT

The Requires

 

laravel logger request response

06/04 2015

1.0.0

1.0.0.0

HTTP request logger middleware for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

laravel logger request response