1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-23 09:36:11 +02:00

Merge branch '1.x'

This commit is contained in:
Jordi Boggiano
2016-07-29 04:53:49 +02:00
5 changed files with 70 additions and 5 deletions

View File

@@ -72,7 +72,7 @@ class RotatingFileHandler extends StreamHandler
if (!preg_match('{^Y(([/_.-]?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")'.
'RotatingFileHandler::FILE_PER_DAY ("Y-m-d"), RotatingFileHandler::FILE_PER_MONTH ("Y-m") '.
'or RotatingFileHandler::FILE_PER_YEAR ("Y"), or you can set one of the '.
'date formats using slashes, underscores and/or dots instead of dashes.'
);

View File

@@ -144,19 +144,25 @@ class SlackHandler extends SocketHandler
'attachments' => [],
];
if ($this->formatter) {
$message = $this->formatter->format($record);
} else {
$message = $record['message'];
}
if ($this->useAttachment) {
$attachment = [
'fallback' => $record['message'],
'fallback' => $message,
'color' => $this->getAttachmentColor($record['level']),
'fields' => [],
];
if ($this->useShortAttachment) {
$attachment['title'] = $record['level_name'];
$attachment['text'] = $record['message'];
$attachment['text'] = $message;
} else {
$attachment['title'] = 'Message';
$attachment['text'] = $record['message'];
$attachment['text'] = $message;
$attachment['fields'][] = [
'title' => 'Level',
'value' => $record['level_name'],
@@ -206,7 +212,7 @@ class SlackHandler extends SocketHandler
$dataArray['attachments'] = json_encode([$attachment]);
} else {
$dataArray['text'] = $record['message'];
$dataArray['text'] = $message;
}
if ($this->iconEmoji) {