-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jcala
committed
Jun 25, 2018
1 parent
33c556b
commit 739fcaf
Showing
2 changed files
with
32 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
|
||
namespace SAREhub\Commons\Logger; | ||
|
||
|
||
use function DI\autowire; | ||
use function DI\create; | ||
use DI\Definition\Helper\CreateDefinitionHelper; | ||
use DI\Definition\Helper\DefinitionHelper; | ||
use function DI\factory; | ||
|
||
class BasicLoggingDefinitions | ||
{ | ||
public static function get(): array | ||
{ | ||
return [ | ||
StreamLoggerFactoryProvider::class => autowire() | ||
->constructorParameter("level", factory(EnvLoggingLevelProvider::class)) | ||
->constructorParameter("formatter", create(DefaultJsonLogFormatter::class)), | ||
LoggerFactory::class => factory(StreamLoggerFactoryProvider::class) | ||
]; | ||
} | ||
|
||
public static function inject(CreateDefinitionHelper $definition, string $loggerName): DefinitionHelper | ||
{ | ||
return $definition->method("setLogger", factory(LoggerFactory::class . "::create") | ||
->parameter("name", $loggerName)); | ||
} | ||
} |