2016-08-08 12:56:19 +03:00
|
|
|
<?php
|
2018-11-24 11:29:51 +03:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2019-07-23 17:36:56 +03:00
|
|
|
use Monolog\Handler\StreamHandler;
|
2016-08-08 12:56:19 +03:00
|
|
|
use Monolog\Logger;
|
|
|
|
|
2019-07-23 17:36:56 +03:00
|
|
|
$isSwoole = extension_loaded('swoole');
|
|
|
|
|
|
|
|
// For swoole, send logs to standard output
|
|
|
|
$logger = $isSwoole ? [
|
|
|
|
'handlers' => [
|
|
|
|
'shlink_rotating_handler' => [
|
|
|
|
'level' => Logger::EMERGENCY, // This basically disables regular file logs
|
|
|
|
],
|
|
|
|
'shlink_stdout_handler' => [
|
|
|
|
'class' => StreamHandler::class,
|
2019-07-23 18:07:40 +03:00
|
|
|
'level' => Logger::DEBUG,
|
2019-07-23 17:36:56 +03:00
|
|
|
'stream' => 'php://stdout',
|
|
|
|
'formatter' => 'dashed',
|
|
|
|
],
|
|
|
|
],
|
2016-08-08 12:56:19 +03:00
|
|
|
|
2019-07-23 17:36:56 +03:00
|
|
|
'loggers' => [
|
|
|
|
'Shlink' => [
|
|
|
|
'handlers' => ['shlink_stdout_handler'],
|
2016-08-08 12:56:19 +03:00
|
|
|
],
|
|
|
|
],
|
2019-07-23 17:36:56 +03:00
|
|
|
] : [
|
|
|
|
'handlers' => [
|
|
|
|
'shlink_rotating_handler' => [
|
|
|
|
'level' => Logger::DEBUG,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
];
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
|
|
|
'logger' => $logger,
|
2016-08-08 12:56:19 +03:00
|
|
|
|
|
|
|
];
|