Skip to content

Commit 0e38972

Browse files
* fixes laravel/octane#1010 * fixing phpstan error * use laravel code style * remove empty line * formatting --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent 39b84dc commit 0e38972

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

src/Illuminate/Log/Context/ContextLogProcessor.php

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,13 @@
22

33
namespace Illuminate\Log\Context;
44

5-
use Illuminate\Contracts\Foundation\Application;
5+
use Illuminate\Container\Container;
66
use Illuminate\Contracts\Log\ContextLogProcessor as ContextLogProcessorContract;
77
use Illuminate\Log\Context\Repository as ContextRepository;
88
use Monolog\LogRecord;
99

1010
class ContextLogProcessor implements ContextLogProcessorContract
1111
{
12-
/**
13-
* Create a new ContextLogProcessor instance.
14-
*
15-
* @param \Illuminate\Contracts\Foundation\Application $app
16-
* @return void
17-
*/
18-
public function __construct(protected Application $app)
19-
{
20-
}
21-
2212
/**
2313
* Add contextual data to the log's "extra" parameter.
2414
*
@@ -27,13 +17,15 @@ public function __construct(protected Application $app)
2717
*/
2818
public function __invoke(LogRecord $record): LogRecord
2919
{
30-
if (! $this->app->bound(ContextRepository::class)) {
20+
$app = Container::getInstance();
21+
22+
if (! $app->bound(ContextRepository::class)) {
3123
return $record;
3224
}
3325

3426
return $record->with(extra: [
3527
...$record->extra,
36-
...$this->app[ContextRepository::class]->all(),
28+
...$app->get(ContextRepository::class)->all(),
3729
]);
3830
}
3931
}

src/Illuminate/Log/Context/ContextServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function register()
1919
{
2020
$this->app->scoped(Repository::class);
2121

22-
$this->app->bind(ContextLogProcessorContract::class, fn ($app) => new ContextLogProcessor($app));
22+
$this->app->bind(ContextLogProcessorContract::class, fn () => new ContextLogProcessor());
2323
}
2424

2525
/**

0 commit comments

Comments
 (0)