Reduced duplication by creating a function that builds test logger config

This commit is contained in:
Alejandro Celaya 2021-03-14 09:01:11 +01:00
parent 562110fac4
commit d7523bcb57

View File

@ -82,6 +82,18 @@ $buildDbConnection = function (): array {
return $driverConfigMap[$driver] ?? [];
};
$buildTestLoggerConfig = fn (string $handlerName, string $filename) => [
'handlers' => [
$handlerName => [
'name' => StreamHandler::class,
'params' => [
'level' => Logger::DEBUG,
'stream' => sprintf('data/log/api-tests/%s', $filename),
],
],
],
];
return [
'debug' => true,
@ -166,28 +178,8 @@ return [
],
'logger' => [
'Shlink' => [
'handlers' => [
'shlink_handler' => [
'name' => StreamHandler::class,
'params' => [
'level' => Logger::DEBUG,
'stream' => 'data/log/api-tests/shlink.log',
],
],
],
],
'Access' => [
'handlers' => [
'access_handler' => [
'name' => StreamHandler::class,
'params' => [
'level' => Logger::DEBUG,
'stream' => 'data/log/api-tests/access.log',
],
],
],
],
'Shlink' => $buildTestLoggerConfig('shlink_handler', 'shlink.log'),
'Access' => $buildTestLoggerConfig('access_handler', 'access.log'),
],
];