File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Illuminated \Console \Log ;
4+
5+ use Monolog \ErrorHandler as MonologErrorHandler ;
6+
7+ class ErrorHandler extends MonologErrorHandler
8+ {
9+ public static function registerIcl ()
10+ {
11+ $ handler = new static (app ('log.icl ' ));
12+ $ handler ->registerErrorHandler ();
13+ $ handler ->registerFatalHandler ();
14+
15+ return $ handler ;
16+ }
17+
18+ public function handleFatalError ()
19+ {
20+ $ logger = app ('log.icl ' );
21+
22+ $ logger ->info ('Execution time: trash. ' );
23+ $ logger ->info ('Memory peak usage: trash. ' );
24+
25+ foreach ($ logger ->getHandlers () as $ handler ) {
26+ $ handler ->close ();
27+ }
28+ }
29+ }
Original file line number Diff line number Diff line change 44
55use Illuminate \Contracts \Debug \ExceptionHandler as ExceptionHandlerContract ;
66use Illuminate \Support \Str ;
7+ use Illuminated \Console \Log \ErrorHandler ;
78use Illuminated \Console \Log \ExceptionHandler ;
89use Illuminated \Console \Log \Formatter ;
9- use Monolog \ErrorHandler ;
1010use Monolog \Handler \RotatingFileHandler ;
1111use Monolog \Logger ;
1212use Symfony \Component \Console \Input \InputInterface ;
@@ -50,7 +50,7 @@ private function initializeErrorHandling()
5050 });
5151 $ this ->icl = app ('log.icl ' );
5252
53- ErrorHandler::register ( $ this -> icl );
53+ ErrorHandler::registerIcl ( );
5454
5555 app ()->singleton (ExceptionHandlerContract::class, ExceptionHandler::class);
5656 }
You can’t perform that action at this time.
0 commit comments