Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d37f9a5

Browse files
committedSep 21, 2023
Interfaces changes for monolog 3.x
1 parent 9fcc602 commit d37f9a5

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed
 

‎composer.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
}
1717
},
1818
"require": {
19-
"php": "^7.3|^7.4|^8.0",
20-
"illuminate/support": "~5.6|^6.0|^7.0|^8.0|^9.0|^10.0"
19+
"php": "^8.1",
20+
"illuminate/support": "^10.0",
21+
"monolog/monolog": "^3.0"
2122
},
2223
"extra": {
2324
"laravel": {

‎src/Processor/AppNameProcessor.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
* Add the local user ID to extra if a user is logged in.
77
*/
88

9-
use Monolog\Processor\ProcessorInterface;
9+
use Monolog\LogRecord;
1010
use Monolog\ResettableInterface;
11+
use Monolog\Processor\ProcessorInterface;
1112

1213
class AppNameProcessor implements ProcessorInterface
1314
{
@@ -20,16 +21,16 @@ public function __construct()
2021
$this->subsystem = config('app.subsystem');
2122
}
2223

23-
public function __invoke(array $record)
24+
public function __invoke(LogRecord $record)
2425
{
2526
// Add system and subsystem names.
2627

2728
if ($this->application) {
28-
$record['extra']['application'] = $this->application;
29+
$record->extra['application'] = $this->application;
2930
}
3031

3132
if ($this->subsystem) {
32-
$record['extra']['subsystem'] = $this->subsystem;
33+
$record->extra['subsystem'] = $this->subsystem;
3334
}
3435

3536
return $record;

‎src/Processor/AuthUserProcessor.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,20 @@
66
* Add the local user ID to extra if a user is logged in.
77
*/
88

9-
use Monolog\Processor\ProcessorInterface;
9+
use Throwable;
10+
use Monolog\LogRecord;
1011
use Monolog\ResettableInterface;
1112
use Illuminate\Support\Facades\Auth;
12-
use Throwable;
13+
use Monolog\Processor\ProcessorInterface;
1314

1415
class AuthUserProcessor implements ProcessorInterface, ResettableInterface
1516
{
1617
protected $userId;
1718

18-
public function __invoke(array $record)
19+
public function __invoke(LogRecord $record)
1920
{
2021
if ($userId = $this->getUserId()) {
21-
$record['extra']['local_user_id'] = $userId;
22+
$record->extra['local_user_id'] = $userId;
2223
}
2324

2425
return $record;

‎src/Processor/JobNameProcessor.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@
66
* Add the currently running job name to the log messages.
77
*/
88

9-
use Monolog\Processor\ProcessorInterface;
9+
use Monolog\LogRecord;
1010
use Monolog\ResettableInterface;
11+
use Monolog\Processor\ProcessorInterface;
1112
use Consilience\Laravel\ExtendedLogging\LoggingService;
1213

1314
class JobNameProcessor implements ProcessorInterface
1415
{
15-
public function __invoke(array $record)
16+
public function __invoke(LogRecord $record)
1617
{
1718
$jobName = app(LoggingService::class)->getJobName();
1819

1920
if ($jobName) {
20-
$record['extra']['job_name'] = $jobName;
21+
$record->extra['job_name'] = $jobName;
2122
}
2223

2324
return $record;

0 commit comments

Comments
 (0)
Please sign in to comment.