File tree Expand file tree Collapse file tree 3 files changed +21
-31
lines changed Expand file tree Collapse file tree 3 files changed +21
-31
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 77
88class ExceptionHandler extends Handler
99{
10+ private $ reservedMemory ;
11+
1012 public function __construct ()
1113 {
14+ $ this ->registerShutdownFunction ();
15+
1216 parent ::__construct (app ('log.icl ' ));
1317 }
1418
@@ -21,4 +25,21 @@ public function report(Exception $e)
2125 'line ' => $ e ->getLine (),
2226 ]);
2327 }
28+
29+ private function registerShutdownFunction ()
30+ {
31+ $ this ->reservedMemory = str_repeat (' ' , 20 * 1024 );
32+
33+ register_shutdown_function (function () {
34+ $ this ->reservedMemory = null ;
35+
36+ $ this ->log ->info ('Execution time: trash. ' );
37+ $ this ->log ->info ('Memory peak usage: trash. ' );
38+
39+ $ handlers = $ this ->log ->getHandlers ();
40+ foreach ($ handlers as $ handler ) {
41+ $ handler ->close ();
42+ }
43+ });
44+ }
2445}
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 ;
87use Illuminated \Console \Log \ExceptionHandler ;
98use Illuminated \Console \Log \Formatter ;
109use Monolog \Handler \RotatingFileHandler ;
@@ -50,8 +49,6 @@ private function initializeErrorHandling()
5049 });
5150 $ this ->icl = app ('log.icl ' );
5251
53- ErrorHandler::registerIcl ();
54-
5552 app ()->singleton (ExceptionHandlerContract::class, ExceptionHandler::class);
5653 }
5754
You can’t perform that action at this time.
0 commit comments