1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-21 00:26:10 +02:00
This commit is contained in:
Jordi Boggiano
2016-05-26 20:54:06 +01:00
parent 85e43a5e7b
commit f200e79879
115 changed files with 1138 additions and 1123 deletions

View File

@@ -70,15 +70,15 @@ class HipChatHandler extends SocketHandler
private $host;
/**
* @param string $token HipChat API Token
* @param string $room The room that should be alerted of the message (Id or Name)
* @param string $name Name used in the "from" field.
* @param bool $notify Trigger a notification in clients or not
* @param int $level The minimum logging level at which this handler will be triggered
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
* @param bool $useSSL Whether to connect via SSL.
* @param string $format The format of the messages (default to text, can be set to html if you have html in the messages)
* @param string $host The HipChat server hostname.
* @param string $token HipChat API Token
* @param string $room The room that should be alerted of the message (Id or Name)
* @param string $name Name used in the "from" field.
* @param bool $notify Trigger a notification in clients or not
* @param int $level The minimum logging level at which this handler will be triggered
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
* @param bool $useSSL Whether to connect via SSL.
* @param string $format The format of the messages (default to text, can be set to html if you have html in the messages)
* @param string $host The HipChat server hostname.
*/
public function __construct($token, $room, $name = 'Monolog', $notify = false, $level = Logger::CRITICAL, $bubble = true, $useSSL = true, $format = 'text', $host = 'api.hipchat.com')
{
@@ -114,12 +114,12 @@ class HipChatHandler extends SocketHandler
*/
private function buildContent($record)
{
$dataArray = array(
$dataArray = [
'notify' => $this->notify ? 'true' : 'false',
'message' => $record['formatted'],
'message_format' => $this->format,
'color' => $this->getAlertColor($record['level']),
);
];
if (!$this->validateStringLength($dataArray['message'], static::MAXIMUM_MESSAGE_LENGTH)) {
if (function_exists('mb_substr')) {
@@ -228,9 +228,9 @@ class HipChatHandler extends SocketHandler
private function combineRecords($records)
{
$batchRecord = null;
$batchRecords = array();
$messages = array();
$formattedMessages = array();
$batchRecords = [];
$messages = [];
$formattedMessages = [];
$level = 0;
$levelName = null;
$datetime = null;
@@ -252,12 +252,12 @@ class HipChatHandler extends SocketHandler
$formattedMessages[] = $this->getFormatter()->format($record);
$formattedMessageStr = implode('', $formattedMessages);
$batchRecord = array(
$batchRecord = [
'message' => $messageStr,
'formatted' => $formattedMessageStr,
'context' => array(),
'extra' => array(),
);
'context' => [],
'extra' => [],
];
if (!$this->validateStringLength($batchRecord['formatted'], static::MAXIMUM_MESSAGE_LENGTH)) {
// Pop the last message and implode the remaining messages
@@ -267,8 +267,8 @@ class HipChatHandler extends SocketHandler
$batchRecord['formatted'] = implode('', $formattedMessages);
$batchRecords[] = $batchRecord;
$messages = array($lastMessage);
$formattedMessages = array($lastFormattedMessage);
$messages = [$lastMessage];
$formattedMessages = [$lastFormattedMessage];
$batchRecord = null;
}
@@ -282,11 +282,11 @@ class HipChatHandler extends SocketHandler
foreach ($batchRecords as &$batchRecord) {
$batchRecord = array_merge(
$batchRecord,
array(
[
'level' => $level,
'level_name' => $levelName,
'datetime' => $datetime,
)
]
);
}