Fix LogDirectoryHandler level

1.x 1.0.4
Julien Rosset 2 years ago
parent 50bf1ea139
commit cdfdd5df9b

@ -20,18 +20,25 @@ class LogDirectoryHandler extends StreamHandler {
/** /**
* Initialization * Initialization
* *
* @param string $dirPath The log directory path * @param string $dirPath The log directory path
* @param int $historyNumberOfDays The maximum number of history files to keep (in number of days) * @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 * @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; $dirPath = $dirPath . DIRECTORY_SEPARATOR;
$this->normalizeDirectory($dirPath, $historyNumberOfDays); $this->normalizeDirectory($dirPath, $historyNumberOfDays);
parent::__construct( parent::__construct(
$dirPath . date('Y-m-d') . '.log', $dirPath . date('Y-m-d') . '.log',
Logger::WARNING $level,
$bubble,
$filePermission,
$useLocking
); );
$this->setFormatter(new LogFileFormatter()); $this->setFormatter(new LogFileFormatter());
} }

Loading…
Cancel
Save