1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-24 10:06:08 +02:00

RotatingFileHandler to maintain the correct maximum number files when using folder by date (#1671)

This commit is contained in:
Gene Alyson Fortunado Torcende
2022-06-09 16:41:11 +08:00
committed by GitHub
parent eac0c22ad2
commit 8ac56aa42b
2 changed files with 103 additions and 1 deletions

View File

@@ -191,7 +191,11 @@ class RotatingFileHandler extends StreamHandler
$fileInfo = pathinfo($this->filename);
$glob = str_replace(
['{filename}', '{date}'],
[$fileInfo['filename'], '[0-9][0-9][0-9][0-9]*'],
[$fileInfo['filename'], str_replace(
['Y', 'y', 'm', 'd'],
['[0-9][0-9][0-9][0-9]', '[0-9][0-9]', '[0-9][0-9]', '[0-9][0-9]'],
$this->dateFormat)
],
$fileInfo['dirname'] . '/' . $this->filenameFormat
);
if (isset($fileInfo['extension'])) {