Download src/Shared/Infrastructure/Providers/LoggerServiceProvider.php from pnacorp/AIKEEDO: direct link, hf CLI and curl.
- Browser
- Download file 883 Bytes
-
https://huggingface.co/pnacorp/AIKEEDO/resolve/main/src/Shared/Infrastructure/Providers/LoggerServiceProvider.php
- Command line
-
hf download hf://pnacorp/AIKEEDO/src/Shared/Infrastructure/Providers/LoggerServiceProvider.php
-
curl -L -o LoggerServiceProvider.php https://huggingface.co/pnacorp/AIKEEDO/resolve/main/src/Shared/Infrastructure/Providers/LoggerServiceProvider.php
883 Bytes
| declare(strict_types=1); | |
| namespace Shared\Infrastructure\Providers; | |
| use Application; | |
| use Easy\Container\Attributes\Inject; | |
| use Monolog\Handler\StreamHandler; | |
| use Monolog\Logger; | |
| use Monolog\Processor\PsrLogMessageProcessor; | |
| use Psr\Log\LoggerInterface; | |
| use Shared\Infrastructure\ServiceProviderInterface; | |
| class LoggerServiceProvider implements ServiceProviderInterface | |
| { | |
| /** | |
| * @param string $logDir | |
| * @return void | |
| */ | |
| public function __construct( | |
| #[Inject('config.dirs.log')] | |
| private string $logDir, | |
| ) { | |
| } | |
| /** @inheritDoc */ | |
| public function register(Application $app): void | |
| { | |
| $logger = new Logger('app'); | |
| $logger->pushHandler(new StreamHandler($this->logDir . '/app.log')); | |
| $logger->pushProcessor(new PsrLogMessageProcessor()); | |
| $app->set(LoggerInterface::class, $logger); | |
| } | |
| } | |