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...
 

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.

References array.

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

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  }
Create styles array
The data for the language used.
+ 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.

References array, and Monolog\Formatter\ChromePHPFormatter\format().

69  {
70  $formatted = array();
71 
72  foreach ($records as $record) {
73  $formatted[] = $this->format($record);
74  }
75 
76  return $formatted;
77  }
$records
Definition: simple_test.php:22
format(array $record)
{Formats a log record.A record to format mixed The formatted record}
Create styles array
The data for the language used.
+ Here is the call graph for this function:

Field Documentation

◆ $logLevels

Monolog\Formatter\ChromePHPFormatter::$logLevels
private
Initial value:
Logger::DEBUG => 'log',
Logger::INFO => 'info',
Logger::NOTICE => 'info',
Logger::WARNING => 'warn',
Logger::ERROR => 'error',
Logger::CRITICAL => 'error',
Logger::ALERT => 'error',
Logger::EMERGENCY => 'error',
)

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: