File tree 3 files changed +21
-31
lines changed
3 files changed +21
-31
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 7
7
8
8
class ExceptionHandler extends Handler
9
9
{
10
+ private $ reservedMemory ;
11
+
10
12
public function __construct ()
11
13
{
14
+ $ this ->registerShutdownFunction ();
15
+
12
16
parent ::__construct (app ('log.icl ' ));
13
17
}
14
18
@@ -21,4 +25,21 @@ public function report(Exception $e)
21
25
'line ' => $ e ->getLine (),
22
26
]);
23
27
}
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
+ }
24
45
}
Original file line number Diff line number Diff line change 4
4
5
5
use Illuminate \Contracts \Debug \ExceptionHandler as ExceptionHandlerContract ;
6
6
use Illuminate \Support \Str ;
7
- use Illuminated \Console \Log \ErrorHandler ;
8
7
use Illuminated \Console \Log \ExceptionHandler ;
9
8
use Illuminated \Console \Log \Formatter ;
10
9
use Monolog \Handler \RotatingFileHandler ;
@@ -50,8 +49,6 @@ private function initializeErrorHandling()
50
49
});
51
50
$ this ->icl = app ('log.icl ' );
52
51
53
- ErrorHandler::registerIcl ();
54
-
55
52
app ()->singleton (ExceptionHandlerContract::class, ExceptionHandler::class);
56
53
}
57
54
You can’t perform that action at this time.
0 commit comments