mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-07 05:36:45 +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:
@@ -81,7 +81,7 @@ class RotatingFileHandler extends StreamHandler
|
|||||||
|
|
||||||
public function setFilenameFormat(string $filenameFormat, string $dateFormat): self
|
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(
|
throw new InvalidArgumentException(
|
||||||
'Invalid date format - format must be one of '.
|
'Invalid date format - format must be one of '.
|
||||||
'RotatingFileHandler::FILE_PER_DAY ("Y-m-d"), RotatingFileHandler::FILE_PER_MONTH ("Y-m") '.
|
'RotatingFileHandler::FILE_PER_DAY ("Y-m-d"), RotatingFileHandler::FILE_PER_MONTH ("Y-m") '.
|
||||||
|
Reference in New Issue
Block a user