-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add LoggerBootloader with default LoggerInterface injector.
- Loading branch information
Showing
6 changed files
with
132 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Spiral\Logger\Bootloader; | ||
|
||
use Psr\Log\LoggerInterface; | ||
use Spiral\Boot\Bootloader\Bootloader; | ||
use Spiral\Core\Container; | ||
use Spiral\Logger\Attribute\LoggerChannel; | ||
use Spiral\Logger\LogFactory; | ||
use Spiral\Logger\LoggerInjector; | ||
use Spiral\Logger\LogsInterface; | ||
use Spiral\Logger\NullLogger; | ||
|
||
/** | ||
* Register {@see LoggerInterface} injector with support for {@see LoggerChannel} attribute. | ||
* Register default {@see LogsInterface} implementation that produces {@see NullLogger}. | ||
*/ | ||
final class LoggerBootloader extends Bootloader | ||
{ | ||
protected const SINGLETONS = [ | ||
LogsInterface::class => LogFactory::class, | ||
]; | ||
|
||
public function init(Container $container): void | ||
{ | ||
$container->bindInjector(LoggerInterface::class, LoggerInjector::class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters