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

support two digit years

With this change you can use two digit years, i.e. $fileHandler->setFilenameFormat('{date}_{filename}', 'y-m-d'); for 19-03-21
This commit is contained in:
Jochen Staerk
2019-03-21 16:58:24 +01:00
committed by GitHub
parent ebb804e432
commit 1985d1ee0c

View File

@@ -81,7 +81,7 @@ class RotatingFileHandler extends StreamHandler
public function setFilenameFormat(string $filenameFormat, string $dateFormat): self
{
if (!preg_match('{^Y(([/_.-]?m)([/_.-]?d)?)?$}', $dateFormat)) {
if (!preg_match('{^[Yy](([/_.-]?m)([/_.-]?d)?)?$}', $dateFormat)) {
throw new InvalidArgumentException(
'Invalid date format - format must be one of '.
'RotatingFileHandler::FILE_PER_DAY ("Y-m-d"), RotatingFileHandler::FILE_PER_MONTH ("Y-m") '.