Skip to content

Commit bfc04ff

Browse files
authored
fix: register context log processor if it exists
1 parent c12a86d commit bfc04ff

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Components/Log/Provider.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
namespace LaravelZero\Framework\Components\Log;
1515

1616
use Illuminate\Contracts\Config\Repository;
17+
use Illuminate\Contracts\Log\ContextLogProcessor as ContextLogProcessorContract;
18+
use Illuminate\Log\Context\ContextLogProcessor;
19+
use Illuminate\Log\LogServiceProvider;
1720
use LaravelZero\Framework\Components\AbstractComponentProvider;
1821

1922
/**
@@ -35,7 +38,10 @@ public function isAvailable(): bool
3538
*/
3639
public function register(): void
3740
{
38-
$this->app->register(\Illuminate\Log\LogServiceProvider::class);
41+
$this->app->register(LogServiceProvider::class);
42+
if (class_exists(ContextLogProcessor::class)) {
43+
$this->app->bind(ContextLogProcessorContract::class, fn () => new ContextLogProcessor());
44+
}
3945

4046
/** @var Repository $config */
4147
$config = $this->app['config'];

0 commit comments

Comments
 (0)