ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Monolog\Formatter\FlowdockFormatter Class Reference

formats the record to be used in the FlowdockHandler More...

+ Inheritance diagram for Monolog\Formatter\FlowdockFormatter:
+ Collaboration diagram for Monolog\Formatter\FlowdockFormatter:

Public Member Functions

 __construct ($source, $sourceEmail)
 
 format (array $record)
 {Formats a log record.
Parameters
array$recordA record to format
Returns
mixed The formatted record
} More...
 
 formatBatch (array $records)
 {Formats a set of log records.
Parameters
array$recordsA set of records to format
Returns
mixed The formatted set of records
} More...
 
 getShortMessage ($message)
 
 format (array $record)
 Formats a log record. More...
 
 formatBatch (array $records)
 Formats a set of log records. More...
 

Private Attributes

 $source
 
 $sourceEmail
 

Detailed Description

formats the record to be used in the FlowdockHandler

Author
Dominik Liebler liebl.nosp@m.er.d.nosp@m.omini.nosp@m.k@gm.nosp@m.ail.c.nosp@m.om

Definition at line 19 of file FlowdockFormatter.php.

Constructor & Destructor Documentation

◆ __construct()

Monolog\Formatter\FlowdockFormatter::__construct (   $source,
  $sourceEmail 
)
Parameters
string$source
string$sourceEmail

Definition at line 35 of file FlowdockFormatter.php.

References Monolog\Formatter\FlowdockFormatter\$source, and Monolog\Formatter\FlowdockFormatter\$sourceEmail.

Member Function Documentation

◆ format()

Monolog\Formatter\FlowdockFormatter::format ( array  $record)

{Formats a log record.

Parameters
array$recordA record to format
Returns
mixed The formatted record
}

Implements Monolog\Formatter\FormatterInterface.

Definition at line 44 of file FlowdockFormatter.php.

45 {
46 $tags = array(
47 '#logs',
48 '#' . strtolower($record['level_name']),
49 '#' . $record['channel'],
50 );
51
52 foreach ($record['extra'] as $value) {
53 $tags[] = '#' . $value;
54 }
55
56 $subject = sprintf(
57 'in %s: %s - %s',
58 $this->source,
59 $record['level_name'],
60 $this->getShortMessage($record['message'])
61 );
62
63 $record['flowdock'] = array(
64 'source' => $this->source,
65 'from_address' => $this->sourceEmail,
66 'subject' => $subject,
67 'content' => $record['message'],
68 'tags' => $tags,
69 'project' => $this->source,
70 );
71
72 return $record;
73 }

References Monolog\Formatter\FlowdockFormatter\getShortMessage().

Referenced by Monolog\Formatter\FlowdockFormatter\formatBatch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ formatBatch()

Monolog\Formatter\FlowdockFormatter::formatBatch ( array  $records)

{Formats a set of log records.

Parameters
array$recordsA set of records to format
Returns
mixed The formatted set of records
}

Implements Monolog\Formatter\FormatterInterface.

Definition at line 78 of file FlowdockFormatter.php.

79 {
80 $formatted = array();
81
82 foreach ($records as $record) {
83 $formatted[] = $this->format($record);
84 }
85
86 return $formatted;
87 }
format(array $record)
{Formats a log record.mixed The formatted record}
$records
Definition: simple_test.php:17

References $records, and Monolog\Formatter\FlowdockFormatter\format().

+ Here is the call graph for this function:

◆ getShortMessage()

Monolog\Formatter\FlowdockFormatter::getShortMessage (   $message)
Parameters
string$message
Returns
string

Definition at line 94 of file FlowdockFormatter.php.

95 {
96 $maxLength = 45;
97
98 if (strlen($message) > $maxLength) {
99 $message = substr($message, 0, $maxLength - 4) . ' ...';
100 }
101
102 return $message;
103 }

Referenced by Monolog\Formatter\FlowdockFormatter\format().

+ Here is the caller graph for this function:

Field Documentation

◆ $source

Monolog\Formatter\FlowdockFormatter::$source
private

◆ $sourceEmail

Monolog\Formatter\FlowdockFormatter::$sourceEmail
private

The documentation for this class was generated from the following file: