app/Bootstrap/ConfigureLogging.php
/**
     * Configure the Monolog handlers for the application.
     *
     * @param  \Illuminate\Contracts\Foundation\Application  $app
     * @param  \Illuminate\Log\Writer  $log
     * @return void
     */
Configure the Monolog handlers for the application.
Configure the Monolog handlers for the application .
protected function configureSingleHandler(Application $app, Writer $log)
    {
        if ($this->isApiCall($app['request'])) {
            $log->useFiles($app->storagePath().'/logs/api.log');
        } else {
            $log->useFiles($app->storagePath().'/logs/laravel.log');
        }
        $log->getMonolog()->pushProcessor(function ($record) {
            $record['extra']['user'] = \Auth::user() ? \Auth::user()->username : 'anonymous';
            $record['extra']['ip'] = \Request::getClientIp();
            return $record;
        });
    }
protected function configureSingleHandler ( Application $ app , Writer $ log ) { if ( $ this -> isApiCall ( $ app [ 'request' ] ) ) { $ log -> useFiles ( $ app -> storagePath ( ) . '/logs/api.log' ) ; } else { $ log -> useFiles ( $ app -> storagePath ( ) . '/logs/laravel.log' ) ; } $ log -> getMonolog ( ) -> pushProcessor ( function ( $ record ) { $ record [ 'extra' ] [ 'user' ] = \ Auth :: user ( ) ? \ Auth :: user ( ) -> username : 'anonymous' ; $ record [ 'extra' ] [ 'ip' ] = \ Request :: getClientIp ( ) ; return $ record ; } ) ; }
Configure the Monolog handlers for the application.
Configure the Monolog handlers for the application .
// Add user name and IP