File tree Expand file tree Collapse file tree 3 files changed +16
-6
lines changed
Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,14 @@ Currently adds
77* Request remote IP
88* Request method and URL, e.g ` GET /customer/account/login `
99
10+ ## Versions
11+
12+ ### 1.x
13+ <= Magento 2.4.7
14+
15+ 2.x
16+ > = Magento 2.4.8
17+
1018## Installation
1119
1220` composer require skywire/m2-logging `
Original file line number Diff line number Diff line change 1111
1212namespace Skywire \Logger \Processor ;
1313
14+ use Monolog \LogRecord ;
1415use Monolog \Processor \ProcessorInterface ;
1516use Magento \Framework \HTTP \PhpEnvironment \RemoteAddress ;
1617
@@ -26,10 +27,10 @@ public function __construct(RemoteAddress $remoteAddress)
2627 $ this ->remoteAddress = $ remoteAddress ;
2728 }
2829
29- public function __invoke (array $ records )
30+ public function __invoke (LogRecord $ record )
3031 {
31- $ records [ ' extra ' ] ['remote_ip ' ] = $ this ->remoteAddress ->getRemoteAddress ();
32+ $ record -> extra ['remote_ip ' ] = $ this ->remoteAddress ->getRemoteAddress ();
3233
33- return $ records ;
34+ return $ record ;
3435 }
3536}
Original file line number Diff line number Diff line change 1111
1212namespace Skywire \Logger \Processor ;
1313
14+ use Monolog \LogRecord ;
1415use Monolog \Processor \ProcessorInterface ;
1516
1617class UrlProcessor implements ProcessorInterface
1718{
18- public function __invoke (array $ records )
19+ public function __invoke (LogRecord $ record )
1920 {
2021 if (isset ($ _SERVER ['REQUEST_METHOD ' ]) && isset ($ _SERVER ['REQUEST_URI ' ])) {
21- $ records [ ' extra ' ] ['url ' ] = $ _SERVER ['REQUEST_METHOD ' ] . ' ' . $ _SERVER ['REQUEST_URI ' ];
22+ $ record -> extra ['url ' ] = $ _SERVER ['REQUEST_METHOD ' ] . ' ' . $ _SERVER ['REQUEST_URI ' ];
2223 }
2324
24- return $ records ;
25+ return $ record ;
2526 }
2627}
You can’t perform that action at this time.
0 commit comments