101 throw new \InvalidArgumentException(
'The supplied name is too long. HipChat\'s v1 API supports names up to 15 UTF-8 characters.');
138 'notify' => $this->version == self::API_V1 ?
139 ($this->notify ? 1 : 0) :
140 ($this->notify ?
'true' :
'false'),
141 'message' => $record[
'formatted'],
142 'message_format' => $this->
format,
147 if (function_exists(
'mb_substr')) {
148 $dataArray[
'message'] = mb_substr(
$dataArray[
'message'], 0, static::MAXIMUM_MESSAGE_LENGTH).
' [truncated]';
150 $dataArray[
'message'] = substr(
$dataArray[
'message'], 0, static::MAXIMUM_MESSAGE_LENGTH).
' [truncated]';
155 if ($this->version == self::API_V1) {
161 if ($this->version == self::API_V1 || $this->name !== null) {
176 if ($this->version == self::API_V1) {
177 $header =
"POST /v1/rooms/message?format=json&auth_token={$this->token} HTTP/1.1\r\n";
180 $room = rawurlencode($this->room);
181 $header =
"POST /v2/room/{$room}/notification?auth_token={$this->token} HTTP/1.1\r\n";
184 $header .=
"Host: {$this->host}\r\n";
185 $header .=
"Content-Type: application/x-www-form-urlencoded\r\n";
186 $header .=
"Content-Length: " . strlen($content) .
"\r\n";
221 parent::write($record);
230 if (count($records) == 0) {
237 foreach ($batchRecords as $batchRecord) {
239 $this->
write($batchRecord);
262 $batchRecords =
array();
264 $formattedMessages =
array();
272 if ($record[
'level'] >
$level) {
273 $level = $record[
'level'];
274 $levelName = $record[
'level_name'];
277 if (null === $datetime) {
278 $datetime = $record[
'datetime'];
283 $formattedMessages[] = $this->
getFormatter()->format($record);
284 $formattedMessageStr = implode(
'', $formattedMessages);
286 $batchRecord =
array(
287 'message' => $messageStr,
288 'formatted' => $formattedMessageStr,
289 'context' =>
array(),
296 $lastFormattedMessage = array_pop($formattedMessages);
298 $batchRecord[
'formatted'] = implode(
'', $formattedMessages);
300 $batchRecords[] = $batchRecord;
302 $formattedMessages =
array($lastFormattedMessage);
308 if (null !== $batchRecord) {
309 $batchRecords[] = $batchRecord;
313 foreach ($batchRecords as &$batchRecord) {
314 $batchRecord = array_merge(
318 'level_name' => $levelName,
319 'datetime' => $datetime,
324 return $batchRecords;
344 if (function_exists(
'mb_strlen')) {
345 return (mb_strlen($str) <= $length);
348 return (strlen($str) <= $length);
const DEBUG
Detailed debug information.
const ERROR
Runtime errors.
Stores to any socket - uses fsockopen() or pfsockopen().
Add rich text string
The name of the decorator.
Sends notifications through the hipchat api to a hipchat room.
handleBatch(array $records)
{Handles a set of records at once.The records to handle (an array of record arrays)} ...
generateDataStream($record)
{}
const API_V2
Use API version v2.
if($is_dev) echo "Review changes write something in WHATSNEW and and then commit with log PHP_EOL
const MAXIMUM_NAME_LENGTH
The maximum allowed length for the name used in the "from" field.
const MAXIMUM_MESSAGE_LENGTH
The maximum allowed length for the message.
getFormatter()
{Gets the formatter.FormatterInterface}
const WARNING
Exceptional occurrences that are not errors.
__construct($token, $room, $name='Monolog', $notify=false, $level=Logger::CRITICAL, $bubble=true, $useSSL=true, $format='text', $host='api.hipchat.com', $version=self::API_V1)
Create styles array
The data for the language used.
const CRITICAL
Critical conditions.
const API_V1
Use API version 1.
isHandling(array $record)
{Checks whether the given record will be handled by this handler.This is mostly done for performance ...
processRecord(array $record)
Processes a record.
buildHeader($content)
Builds the header of the API Call.
Write to Excel2007 format
combineRecords($records)
Combines multiple records into one.
getAlertColor($level)
Assigns a color to each level of log records.
closeSocket()
Close socket, if open.
validateStringLength($str, $length)
Validates the length of a string.
buildContent($record)
Builds the body of API call.
const INFO
Interesting events.