File tree Expand file tree Collapse file tree 2 files changed +6
-14
lines changed
src/Illuminate/Log/Context Expand file tree Collapse file tree 2 files changed +6
-14
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace Illuminate \Log \Context ;
4
4
5
- use Illuminate \Contracts \ Foundation \ Application ;
5
+ use Illuminate \Container \ Container ;
6
6
use Illuminate \Contracts \Log \ContextLogProcessor as ContextLogProcessorContract ;
7
7
use Illuminate \Log \Context \Repository as ContextRepository ;
8
8
use Monolog \LogRecord ;
9
9
10
10
class ContextLogProcessor implements ContextLogProcessorContract
11
11
{
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
-
22
12
/**
23
13
* Add contextual data to the log's "extra" parameter.
24
14
*
@@ -27,13 +17,15 @@ public function __construct(protected Application $app)
27
17
*/
28
18
public function __invoke (LogRecord $ record ): LogRecord
29
19
{
30
- if (! $ this ->app ->bound (ContextRepository::class)) {
20
+ $ app = Container::getInstance ();
21
+
22
+ if (! $ app ->bound (ContextRepository::class)) {
31
23
return $ record ;
32
24
}
33
25
34
26
return $ record ->with (extra: [
35
27
...$ record ->extra ,
36
- ...$ this -> app [ ContextRepository::class] ->all (),
28
+ ...$ app -> get ( ContextRepository::class) ->all (),
37
29
]);
38
30
}
39
31
}
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ public function register()
19
19
{
20
20
$ this ->app ->scoped (Repository::class);
21
21
22
- $ this ->app ->bind (ContextLogProcessorContract::class, fn ($ app ) => new ContextLogProcessor ($ app ));
22
+ $ this ->app ->bind (ContextLogProcessorContract::class, fn () => new ContextLogProcessor ());
23
23
}
24
24
25
25
/**
You can’t perform that action at this time.
0 commit comments