florinmotoc / laravel-logs
Laravel logs
Installs: 179
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/florinmotoc/laravel-logs
Requires
- php: >=8.1
 - illuminate/http: *
 - illuminate/log: *
 - illuminate/queue: *
 - illuminate/support: *
 - monolog/monolog: *
 - symfony/console: *
 - symfony/var-dumper: *
 
This package is auto-updated.
Last update: 2025-10-04 15:35:26 UTC
README
This will log in json format to laravel.log with extra information, and when used via CLI it will log in human-readable format in console output, and also in json format in laravel.log.
Installation
Install the latest version with
composer require florinmotoc/laravel-logs
Basic Usage
<?php // laravel's config/logging.php file: return [ 'default' => env('LOG_CHANNEL', 'fm_stack'), 'channels' => [ 'fm_stack' => [ 'driver' => 'stack', 'channels' => ['fm_console', 'fm_file'], 'ignore_exceptions' => false, ], 'fm_console' => [ 'driver' => 'monolog', 'handler' => \FlorinMotoc\LaravelLogs\LaravelMonologTap\Handler\ConsoleHandler::class, 'with' => [ 'verbosity' => env('CONSOLE_VERBOSITY'), // \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_DEBUG ] ], 'fm_file' => [ 'driver' => 'monolog', 'formatter' => Monolog\Formatter\JsonFormatter::class, 'handler' => Monolog\Handler\StreamHandler::class, 'with' => [ 'stream' => storage_path('logs/laravel.log'), 'level' => 'debug', ], 'tap' => [ \FlorinMotoc\LaravelLogs\LaravelMonologTap\LaravelMonologTap::class ], ], ] ]
LOG_CHANNEL=fm_stack FM_LARAVEL_LOGS_USE_EXTRA_PID=true FM_LARAVEL_LOGS_USE_EXTRA_JOB_INFO=true FM_LARAVEL_LOGS_USE_EXTRA_INTROSPECTION=true # change this to one of \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_* values for more logs - 256 is very verbose! CONSOLE_VERBOSITY=256
- set 
LOG_CHANNEL=fm_stackin your.envfile to activateLaravelMonologTap- also need to change laravel's 
config/logging.phpfile with above contents! 
 - also need to change laravel's 
 - set 
FM_LARAVEL_LOGS_USE_EXTRA_PID=truein your.envfile if you want to add the PID to the monolog extra array. - set 
FM_LARAVEL_LOGS_USE_EXTRA_JOB_INFO=truein your.envfile if you want to add the laravel queue jobs id to the monolog extra array. - set 
FM_LARAVEL_LOGS_USE_EXTRA_INTROSPECTION=truein your.envfile if you want to add the\Monolog\Processor\IntrospectionProcessorto the monolog extra array. (this will add file,class,function,line) - optionally set 
CONSOLE_VERBOSITY=in your.envfile to control verbosity- change this to one of 
\Symfony\Component\Console\Output\OutputInterface::VERBOSITY_*values for more logs - 256 is very verbose!- VERBOSITY_QUIET = 16;
 - VERBOSITY_NORMAL = 32;
 - VERBOSITY_VERBOSE = 64;
 - VERBOSITY_VERY_VERBOSE = 128;
 - VERBOSITY_DEBUG = 256;
 
 
 - change this to one of