From db9a0a6d8ce7dbbc36ce17ab4c2ab79e798c9e14 Mon Sep 17 00:00:00 2001 From: Max Nuding Date: Mon, 26 May 2025 13:12:15 +0200 Subject: [PATCH] added support for logrotate, fox #5 --- src/Roastmonday.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Roastmonday.php b/src/Roastmonday.php index 4655fa2..c8aa562 100644 --- a/src/Roastmonday.php +++ b/src/Roastmonday.php @@ -15,14 +15,19 @@ class Roastmonday extends APnutI 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( $config['client_secret'], $config['client_id'], $config['scope'], $app_name, $config['redirect_url'], - __DIR__ . '/../logs/roastmonday.log', - 'DEBUG' + $log_path, + $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->pics_root = $pics_root . 'pics/';