mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Custom logging to only show debug info if the app is in debug mode
or if the user has overridden the APP_LOG_LEVEL in their env
This commit is contained in:
parent
b614470b21
commit
820d37cabb
|
@ -4,6 +4,7 @@ namespace App\Providers;
|
|||
use Validator;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use DB;
|
||||
use Log;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -78,6 +79,20 @@ class AppServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
$monolog = Log::getMonolog();
|
||||
|
||||
if (config('app.debug')) {
|
||||
$log_level = 'debug';
|
||||
} else {
|
||||
if (config('log-level')) {
|
||||
$log_level = config('log-level');
|
||||
} else {
|
||||
$log_level = 'error';
|
||||
}
|
||||
}
|
||||
|
||||
foreach($monolog->getHandlers() as $handler) {
|
||||
$handler->setLevel($log_level);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,6 +109,7 @@ return [
|
|||
*/
|
||||
|
||||
'log' => env('APP_LOG', 'single'),
|
||||
'log-level' => env('APP_LOG_LEVEL', 'error'),
|
||||
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue