2016-08-08 04:17:14 -05:00
|
|
|
<?php
|
2019-10-05 10:26:10 -05:00
|
|
|
|
2017-10-12 03:13:20 -05:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2018-10-20 05:37:26 -05:00
|
|
|
namespace Shlinkio\Shlink;
|
|
|
|
|
2016-08-08 04:56:19 -05:00
|
|
|
use Monolog\Handler\RotatingFileHandler;
|
2018-11-24 02:29:51 -06:00
|
|
|
use Monolog\Handler\StreamHandler;
|
2016-08-08 04:56:19 -05:00
|
|
|
use Monolog\Logger;
|
2018-10-20 05:37:26 -05:00
|
|
|
use Monolog\Processor;
|
2019-09-11 13:25:04 -05:00
|
|
|
use Psr\Log\LoggerInterface;
|
2019-02-26 15:56:43 -06:00
|
|
|
|
2018-10-20 05:37:26 -05:00
|
|
|
use const PHP_EOL;
|
2016-08-08 04:56:19 -05:00
|
|
|
|
2016-08-08 04:17:14 -05:00
|
|
|
return [
|
|
|
|
|
|
|
|
'logger' => [
|
2016-08-08 04:56:19 -05:00
|
|
|
'formatters' => [
|
|
|
|
'dashed' => [
|
2018-10-20 05:37:26 -05:00
|
|
|
'format' => '[%datetime%] %channel%.%level_name% - %message%' . PHP_EOL,
|
2016-08-08 04:56:19 -05:00
|
|
|
'include_stacktraces' => true,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
|
|
|
|
'handlers' => [
|
2018-11-25 10:14:03 -06:00
|
|
|
'shlink_rotating_handler' => [
|
2016-08-08 04:56:19 -05:00
|
|
|
'class' => RotatingFileHandler::class,
|
|
|
|
'level' => Logger::INFO,
|
|
|
|
'filename' => 'data/log/shlink_log.log',
|
2018-11-24 02:29:51 -06:00
|
|
|
'max_files' => 30,
|
2018-11-25 10:14:03 -06:00
|
|
|
'formatter' => 'dashed',
|
|
|
|
],
|
2019-05-13 12:16:14 -05:00
|
|
|
'access_handler' => [
|
2018-11-25 10:14:03 -06:00
|
|
|
'class' => StreamHandler::class,
|
|
|
|
'level' => Logger::INFO,
|
|
|
|
'stream' => 'php://stdout',
|
2016-08-08 04:56:19 -05:00
|
|
|
],
|
|
|
|
],
|
|
|
|
|
2018-10-20 05:37:26 -05:00
|
|
|
'processors' => [
|
|
|
|
'exception_with_new_line' => [
|
|
|
|
'class' => Common\Logger\Processor\ExceptionWithNewLineProcessor::class,
|
|
|
|
],
|
|
|
|
'psr3' => [
|
|
|
|
'class' => Processor\PsrLogMessageProcessor::class,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
|
2016-08-08 04:17:14 -05:00
|
|
|
'loggers' => [
|
|
|
|
'Shlink' => [
|
2019-11-30 02:28:09 -06:00
|
|
|
'handlers' => [
|
|
|
|
// Using a key allows for this to be overwritten
|
|
|
|
'shlink_handler' => 'shlink_rotating_handler',
|
|
|
|
],
|
2018-10-20 05:37:26 -05:00
|
|
|
'processors' => ['exception_with_new_line', 'psr3'],
|
2016-08-08 04:17:14 -05:00
|
|
|
],
|
2019-05-13 12:16:14 -05:00
|
|
|
'Access' => [
|
|
|
|
'handlers' => ['access_handler'],
|
|
|
|
'processors' => ['exception_with_new_line', 'psr3'],
|
2018-11-25 10:14:03 -06:00
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
|
|
|
|
'dependencies' => [
|
|
|
|
'factories' => [
|
2019-08-07 06:50:38 -05:00
|
|
|
'Logger_Shlink' => Common\Logger\LoggerFactory::class,
|
|
|
|
'Logger_Access' => Common\Logger\LoggerFactory::class,
|
2018-11-25 10:14:03 -06:00
|
|
|
],
|
2019-09-11 13:25:04 -05:00
|
|
|
'aliases' => [
|
|
|
|
'logger' => 'Logger_Shlink',
|
|
|
|
Logger::class => 'Logger_Shlink',
|
|
|
|
LoggerInterface::class => 'Logger_Shlink',
|
|
|
|
],
|
2018-11-25 10:14:03 -06:00
|
|
|
],
|
|
|
|
|
|
|
|
'zend-expressive-swoole' => [
|
|
|
|
'swoole-http-server' => [
|
|
|
|
'logger' => [
|
2019-05-13 12:16:14 -05:00
|
|
|
'logger-name' => 'Logger_Access',
|
2018-11-25 10:14:03 -06:00
|
|
|
],
|
2016-08-08 04:17:14 -05:00
|
|
|
],
|
|
|
|
],
|
|
|
|
|
|
|
|
];
|