ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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'], $record['extra']['line'])) {
45 $backtrace = $record['extra']['file'].' : '.$record['extra']['line'];
46 unset($record['extra']['file'], $record['extra']['line']);
47 }
48
49 $message = array('message' => $record['message']);
50 if ($record['context']) {
51 $message['context'] = $record['context'];
52 }
53 if ($record['extra']) {
54 $message['extra'] = $record['extra'];
55 }
56 if (count($message) === 1) {
57 $message = reset($message);
58 }
59
60 return array(
61 $record['channel'],
62 $message,
63 $backtrace,
64 $this->logLevels[$record['level']],
65 );
66 }

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 68 of file ChromePHPFormatter.php.

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

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: