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

Always append "from" field when sending to HipChat

This commit is contained in:
Jannik Zschiesche
2015-11-18 10:25:04 +01:00
parent 45d243f0ab
commit fa38530fdc

View File

@ -141,7 +141,6 @@ class HipChatHandler extends SocketHandler
'message' => $record['formatted'], 'message' => $record['formatted'],
'message_format' => $this->format, 'message_format' => $this->format,
'color' => $this->getAlertColor($record['level']), 'color' => $this->getAlertColor($record['level']),
'from' => $this->name,
); );
// if we are using the legacy API then we need to send some additional information // if we are using the legacy API then we need to send some additional information
@ -149,6 +148,12 @@ class HipChatHandler extends SocketHandler
$dataArray['room_id'] = $this->room; $dataArray['room_id'] = $this->room;
} }
// append the sender name if it is set
// always append it if we use the v1 api (it is required in v1)
if ($this->version == self::API_V1 || $this->name !== null) {
$dataArray['from'] = (string) $this->name;
}
return http_build_query($dataArray); return http_build_query($dataArray);
} }