mirror of
https://github.com/shlinkio/shlink.git
synced 2024-12-01 12:59:24 -06:00
41 lines
846 B
Plaintext
41 lines
846 B
Plaintext
<?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,
|
|
|
|
];
|