2017 © Pedro Peláez
 

package laravel-user-logger

A package injecting metadata about the logged user into the logs

image

tzk/laravel-user-logger

A package injecting metadata about the logged user into the logs

  • Tuesday, July 4, 2017
  • by TZK-
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Laravel User Logger

Laravel User Logger is a package used to append user specific data into the log files. It could be used to track which user produced an exception in order to help debugging., (*1)

Exemple

#31 app\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(104): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#32 app\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(150): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#33 app\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(117): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#34 app\public\index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#35 {main}  {"user":1}

As you can see the stack trace is completed by a custom attribute user displaying the id of the user who provoked the exception., (*2)

If the user isn't logged it will write anonymous. Else if the exception has been thrown before the session start, the user information will not be displayed., (*3)

Installation

Begin by installing the package with Composer., (*4)

composer require tzk/laravel-user-logger

Once the installation is complete, add the service provider in your config/app.php file:, (*5)

TZK\UserLogger\Providers\UserLoggerServiceProvider::class,

Then you'll need to change in your app/Http/Kernel.php file the middleware, (*6)

\Illuminate\Session\Middleware\StartSession::class

to this one, (*7)

\TZK\UserLogger\Http\Middlewares\StartSession::class

Configuration

By default the package uses the primary key of your User model. This behavior can be overridden by publishing the package config file., (*8)

php artisan vendor:publish --provider="TZK\UserLogger\Providers\UserLoggerServiceProvider"

This command will create a user_logger.php config file in your config folder in which you could specify which user attribute you would display in your logs., (*9)

The Versions

04/07 2017

dev-master

9999999-dev

A package injecting metadata about the logged user into the logs

  Sources   Download

MIT

The Requires

 

04/07 2017

v1.0.0

1.0.0.0

A package injecting metadata about the logged user into the logs

  Sources   Download

MIT

The Requires