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

Merge remote-tracking branch 'rpkamp/master'

This commit is contained in:
Jordi Boggiano
2016-05-20 19:43:01 +01:00
2 changed files with 12 additions and 19 deletions

View File

@@ -11,6 +11,7 @@
namespace Monolog\Handler;
use InvalidArgumentException;
use Monolog\Logger;
/**
@@ -69,17 +70,15 @@ class RotatingFileHandler extends StreamHandler
public function setFilenameFormat($filenameFormat, $dateFormat)
{
if (!in_array($dateFormat, array(self::FILE_PER_DAY, self::FILE_PER_MONTH, self::FILE_PER_YEAR))) {
trigger_error(
'Invalid date format - format should be one of '.
throw new InvalidArgumentException(
'Invalid date format - format must be one of '.
'RotatingFileHandler::FILE_PER_DAY, RotatingFileHandler::FILE_PER_MONTH '.
'or RotatingFileHandler::FILE_PER_YEAR.',
E_USER_DEPRECATED
'or RotatingFileHandler::FILE_PER_YEAR.'
);
}
if (substr_count($filenameFormat, '{date}') === 0) {
trigger_error(
'Invalid filename format - format should contain at least `{date}`, because otherwise rotating is impossible.',
E_USER_DEPRECATED
throw new InvalidArgumentException(
'Invalid filename format - format must contain at least `{date}`, because otherwise rotating is impossible.'
);
}
$this->filenameFormat = $filenameFormat;