From cdfdd5df9b58ce220ba78e7b9e68156e370a9093 Mon Sep 17 00:00:00 2001 From: Julien Rosset Date: Wed, 31 May 2023 15:09:49 +0200 Subject: [PATCH] Fix LogDirectoryHandler level --- src/ExtendedMonolog/LogDirectoryHandler.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/ExtendedMonolog/LogDirectoryHandler.php b/src/ExtendedMonolog/LogDirectoryHandler.php index 2c2722f..974028b 100644 --- a/src/ExtendedMonolog/LogDirectoryHandler.php +++ b/src/ExtendedMonolog/LogDirectoryHandler.php @@ -20,18 +20,25 @@ class LogDirectoryHandler extends StreamHandler { /** * Initialization * - * @param string $dirPath The log directory path - * @param int $historyNumberOfDays The maximum number of history files to keep (in number of days) + * @param string $dirPath The log directory path + * @param int|string $level The minimum logging level at which this handler will be triggered + * @param int $historyNumberOfDays The maximum number of history files to keep (in number of days) + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write) + * @param bool $useLocking Try to lock log file before doing any writes * * @throws Throwable If an error occurs */ - public function __construct (string $dirPath, int $historyNumberOfDays = 30) { + public function __construct (string $dirPath, $level = Logger::DEBUG, int $historyNumberOfDays = 30, bool $bubble = true, ?int $filePermission = null, bool $useLocking = false) { $dirPath = $dirPath . DIRECTORY_SEPARATOR; $this->normalizeDirectory($dirPath, $historyNumberOfDays); parent::__construct( $dirPath . date('Y-m-d') . '.log', - Logger::WARNING + $level, + $bubble, + $filePermission, + $useLocking ); $this->setFormatter(new LogFileFormatter()); }