@@ -28,30 +28,36 @@ public function boot()
28
28
29
29
// Listen to log messages.
30
30
$ app ['log ' ]->listen (function () use ($ app ) {
31
- $ args = func_get_args ();
32
-
33
- // Laravel 5.4 returns a MessageLogged instance only
34
- if (count ($ args ) == 1 ) {
35
- $ level = $ args [0 ]->level ;
36
- $ message = $ args [0 ]->message ;
37
- $ context = $ args [0 ]->context ;
38
- } else {
39
- $ level = $ args [0 ];
40
- $ message = $ args [1 ];
41
- $ context = $ args [2 ];
42
- }
43
-
44
- if (strpos ($ message , 'Unable to send messages to Rollbar API. Produced response: ' ) !== false ) {
45
- return ;
46
- }
47
-
48
- $ result = $ app [RollbarLogHandler::class]->log ($ level , $ message , $ context );
49
31
50
- if (!$ result || !$ result ->getStatus ()) {
51
- \Log::error (
52
- 'Unable to send messages to Rollbar API. Produced response: ' .
53
- print_r ($ result , true )
54
- );
32
+ try {
33
+
34
+ $ args = func_get_args ();
35
+
36
+ // Laravel 5.4 returns a MessageLogged instance only
37
+ if (count ($ args ) == 1 ) {
38
+ $ level = $ args [0 ]->level ;
39
+ $ message = $ args [0 ]->message ;
40
+ $ context = $ args [0 ]->context ;
41
+ } else {
42
+ $ level = $ args [0 ];
43
+ $ message = $ args [1 ];
44
+ $ context = $ args [2 ];
45
+ }
46
+
47
+ if (strpos ($ message , 'Unable to send messages to Rollbar API. Produced response: ' ) !== false ) {
48
+ return ;
49
+ }
50
+
51
+ $ result = $ app [RollbarLogHandler::class]->log ($ level , $ message , $ context );
52
+
53
+ if (!$ result || !$ result ->getStatus ()) {
54
+ \Log::error (
55
+ 'Unable to send messages to Rollbar API. Produced response: ' .
56
+ print_r ($ result , true )
57
+ );
58
+ }
59
+
60
+ } catch (\Exception $ exception ) {
55
61
}
56
62
});
57
63
}
0 commit comments