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

Formats a log message according to the ChromePHP array format. More...

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

Public Member Functions

 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. More...
 
 format (array $record)
 Formats a log record. More...
 
 formatBatch (array $records)
 Formats a set of log records. More...
 

Private Attributes

 $logLevels
 Translates Monolog log levels to Wildfire levels. More...
 

Detailed Description

Formats a log message according to the ChromePHP array format.

Author
Christophe Coevoet stof@.nosp@m.notk.nosp@m..org

Definition at line 21 of file ChromePHPFormatter.php.

Member Function Documentation

◆ format()

Monolog\Formatter\ChromePHPFormatter::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 40 of file ChromePHPFormatter.php.

41 {
42 // Retrieve the line and file if set and remove them from the formatted extra
43 $backtrace = 'unknown';
44 if (isset($record['extra']['file']) && isset($record['extra']['line'])) {
45 $backtrace = $record['extra']['file'].' : '.$record['extra']['line'];
46 unset($record['extra']['file']);
47 unset($record['extra']['line']);
48 }
49
50 $message = array('message' => $record['message']);
51 if ($record['context']) {
52 $message['context'] = $record['context'];
53 }
54 if ($record['extra']) {
55 $message['extra'] = $record['extra'];
56 }
57 if (count($message) === 1) {
58 $message = reset($message);
59 }
60
61 return array(
62 $record['channel'],
63 $message,
64 $backtrace,
65 $this->logLevels[$record['level']],
66 );
67 }

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

+ Here is the caller graph for this function:

◆ formatBatch()

Monolog\Formatter\ChromePHPFormatter::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 69 of file ChromePHPFormatter.php.

70 {
71 $formatted = array();
72
73 foreach ($records as $record) {
74 $formatted[] = $this->format($record);
75 }
76
77 return $formatted;
78 }
format(array $record)
{Formats a log record.mixed The formatted record}
$records
Definition: simple_test.php:17

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

+ Here is the call graph for this function:

Field Documentation

◆ $logLevels

Monolog\Formatter\ChromePHPFormatter::$logLevels
private
Initial value:
= array(
Logger::DEBUG => 'log',
Logger::INFO => 'info',
Logger::NOTICE => 'info',
Logger::WARNING => 'warn',
Logger::ERROR => 'error',
Logger::CRITICAL => 'error',
Logger::ALERT => 'error',
Logger::EMERGENCY => 'error',
)
const EMERGENCY
Urgent alert.
Definition: Logger.php:77
const ERROR
Runtime errors.
Definition: Logger.php:57
const CRITICAL
Critical conditions.
Definition: Logger.php:64
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:52
const INFO
Interesting events.
Definition: Logger.php:39
const DEBUG
Detailed debug information.
Definition: Logger.php:32
const NOTICE
Uncommon events.
Definition: Logger.php:44
const ALERT
Action must be taken immediately.
Definition: Logger.php:72

Translates Monolog log levels to Wildfire levels.

Definition at line 26 of file ChromePHPFormatter.php.


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