mirror of
https://github.com/shlinkio/shlink.git
synced 2024-12-22 04:34:50 +03:00
40 lines
846 B
Text
40 lines
846 B
Text
<?php
|
|
declare(strict_types=1);
|
|
|
|
use Monolog\Handler\StreamHandler;
|
|
use Monolog\Logger;
|
|
|
|
$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,
|
|
'level' => Logger::DEBUG,
|
|
'stream' => 'php://stdout',
|
|
'formatter' => 'dashed',
|
|
],
|
|
],
|
|
|
|
'loggers' => [
|
|
'Shlink' => [
|
|
'handlers' => ['shlink_stdout_handler'],
|
|
],
|
|
],
|
|
] : [
|
|
'handlers' => [
|
|
'shlink_rotating_handler' => [
|
|
'level' => Logger::DEBUG,
|
|
],
|
|
],
|
|
];
|
|
|
|
return [
|
|
|
|
'logger' => $logger,
|
|
|
|
];
|