Hi,
I tried to change the actual logger that writes out rotated files with syslog like so:
src/SyslogServiceProvider.php
namespace Grey\Flarum;
use Flarum\Foundation\AbstractServiceProvider;
use Illuminate\Contracts\Container\Container;
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\SyslogHandler;
use Monolog\Logger;
use Psr\Log\LoggerInterface;
class SyslogServiceProvider extends AbstractServiceProvider
{
public function register()
{
$handler = new SyslogHandler('flarum', LOG_USER, Logger::INFO);
$handler->setFormatter(new LineFormatter(null, null, true, true));
$this->container->instance('log', new Logger('flarum', [$handler]));
$this->container->alias('log', LoggerInterface::class);
}
}
extend.php:
use Flarum\Extend;
return [
(new Extend\ServiceProvider())->register(Grey\Flarum\SyslogServiceProvider::class),
];
It's working but I wonder if it is the correct way to do it ?