-
-
Save joshle/65bc2aa4a37dd3b7daaf467c8f389c72 to your computer and use it in GitHub Desktop.
laravel 5 - configuring minimal log level
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // app/config/app.php | |
| return [ | |
| // .... | |
| 'log-level' => 'info', | |
| 'log' => 'errorlog', | |
| ]; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App\Providers; | |
| use Illuminate\Support\ServiceProvider; | |
| use Log; | |
| use Config; | |
| class AppServiceProvider extends ServiceProvider | |
| { | |
| /** | |
| * Bootstrap any application services. | |
| * | |
| * @return void | |
| */ | |
| public function boot() | |
| { | |
| // | |
| } | |
| /** | |
| * Register any application services. | |
| * | |
| * @return void | |
| */ | |
| public function register() | |
| { | |
| // | |
| $monolog = Log::getMonolog(); | |
| foreach($monolog->getHandlers() as $handler) { | |
| $handler->setLevel(Config::get('app.log-level')); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment