added support for logrotate, fox #5

This commit is contained in:
Max Nuding 2025-05-26 13:12:15 +02:00
parent 70776ac21f
commit db9a0a6d8c
Signed by: phlaym
SSH Key Fingerprint: SHA256:mionmF+5trOUI1AxqzAU1ZK3tv6IiDcdKGXcMWwa1nQ

View File

@ -15,14 +15,19 @@ class Roastmonday extends APnutI
public function __construct($config, $pics_root = "", $app_name = 'Roastmonday') public function __construct($config, $pics_root = "", $app_name = 'Roastmonday')
{ {
$log_path = $config['log_file'] ?? __DIR__ . '/../logs/roastmonday.log';
$use_logrotate = $config['use_logrotate'] ?? false;
parent::__construct( parent::__construct(
$config['client_secret'], $config['client_secret'],
$config['client_id'], $config['client_id'],
$config['scope'], $config['scope'],
$app_name, $app_name,
$config['redirect_url'], $config['redirect_url'],
__DIR__ . '/../logs/roastmonday.log', $log_path,
'DEBUG' $config['log_level'],
use_rotating_file_handler: !$use_logrotate,
use_stream_handler: $use_logrotate,
use_syslog_handler: false
); );
$this->logger->info("App: {$this->app_name}"); $this->logger->info("App: {$this->app_name}");
$this->pics_root = $pics_root . 'pics/'; $this->pics_root = $pics_root . 'pics/';