File tree 2 files changed +24
-11
lines changed
2 files changed +24
-11
lines changed Original file line number Diff line number Diff line change 22
22
}
23
23
],
24
24
"require" : {
25
- "php" : " >=7.2| ^8.0 " ,
26
- "illuminate/support" : " ^6.0|^7.0|^8.0|^9.0|^ 10.0" ,
27
- "rollbar/rollbar" : " ^2.0 | ^3.1 "
25
+ "php" : " ^8.1 " ,
26
+ "illuminate/support" : " ^10.0" ,
27
+ "rollbar/rollbar" : " ^4.0 "
28
28
},
29
29
"require-dev" : {
30
- "orchestra/testbench" : " ^4.0|^5.0|^6.0|^7 .0" ,
30
+ "orchestra/testbench" : " ^8 .0" ,
31
31
"mockery/mockery" : " ^1" ,
32
32
"php-coveralls/php-coveralls" : " ^2.2" ,
33
33
"squizlabs/php_codesniffer" : " 3.*" ,
Original file line number Diff line number Diff line change 3
3
namespace Rollbar \Laravel ;
4
4
5
5
use Monolog \Handler \RollbarHandler ;
6
+ use Monolog \LogRecord ;
6
7
7
8
class MonologHandler extends RollbarHandler
8
9
{
9
10
protected $ app ;
10
11
12
+ /**
13
+ * @param $app
14
+ * @return void
15
+ */
11
16
public function setApp ($ app )
12
17
{
13
18
$ this ->app = $ app ;
14
19
}
15
20
16
- protected function write (array $ record ): void
21
+ /**
22
+ * @param LogRecord $record
23
+ * @return void
24
+ */
25
+ protected function write (LogRecord $ record ): void
17
26
{
18
- $ record ['context ' ] = $ this ->addContext ($ record ['context ' ]);
19
- parent ::write ($ record );
27
+ parent ::write (new LogRecord ($ record ->datetime ,
28
+ $ record ->channel ,
29
+ $ record ->level ,
30
+ $ record ->message ,
31
+ $ this ->addContext ($ record ->context ),
32
+ $ record ->extra ,
33
+ $ record ->formatted ));
20
34
}
21
35
22
36
/**
23
- * Add Laravel specific information to the context.
24
- *
25
37
* @param array $context
38
+ * @return array
26
39
*/
27
- protected function addContext (array $ context = [])
40
+ protected function addContext (array $ context = []): array
28
41
{
29
42
$ config = $ this ->rollbarLogger ->extend ([]);
30
43
@@ -47,7 +60,7 @@ protected function addContext(array $context = [])
47
60
} elseif (method_exists ($ data , 'getKey ' )) {
48
61
$ person ['id ' ] = $ data ->getKey ();
49
62
}
50
-
63
+
51
64
if (isset ($ person ['id ' ])) {
52
65
if (isset ($ data ->username )) {
53
66
$ person ['username ' ] = $ data ->username ;
You can’t perform that action at this time.
0 commit comments