MediaWiki  1.29.1
MediaWiki\Logger\Monolog\LineFormatter Class Reference

Formats incoming records into a one-line string. More...

Inheritance diagram for MediaWiki\Logger\Monolog\LineFormatter:
Collaboration diagram for MediaWiki\Logger\Monolog\LineFormatter:

Public Member Functions

 __construct ( $format=null, $dateFormat=null, $allowInlineLineBreaks=false, $ignoreEmptyContextAndExtra=false, $includeStacktraces=false)
 
 format (array $record)
 {} More...
 

Protected Member Functions

 exceptionAsArray (Exception $e)
 Convert an exception to an array of structured data. More...
 
 normalizeException ( $e)
 Convert an Exception to a string. More...
 
 normalizeExceptionArray (array $e)
 Convert an array of Exception data to a string. More...
 

Detailed Description

Formats incoming records into a one-line string.

An 'exeception' in the log record's context will be treated specially. It will be output for an 'exception' placeholder in the format and excluded from 'context' output if the 'exception' placeholder is present.

Exceptions that are logged with this formatter will optional have their stack traces appended. If that is done, MWExceptionHandler::redactedTrace() will be used to redact the trace information.

Since
1.26
Author
Bryan Davis bd808.nosp@m.@wik.nosp@m.imedi.nosp@m.a.or.nosp@m.g
Note
© 2015 Bryan Davis and Wikimedia Foundation.

Definition at line 43 of file LineFormatter.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Logger\Monolog\LineFormatter::__construct (   $format = null,
  $dateFormat = null,
  $allowInlineLineBreaks = false,
  $ignoreEmptyContextAndExtra = false,
  $includeStacktraces = false 
)
Parameters
string$formatThe format of the message
string$dateFormatThe format of the timestamp: one supported by DateTime::format
bool$allowInlineLineBreaksWhether to allow inline line breaks in log entries
bool$ignoreEmptyContextAndExtra
bool$includeStacktraces

Definition at line 52 of file LineFormatter.php.

Member Function Documentation

◆ exceptionAsArray()

MediaWiki\Logger\Monolog\LineFormatter::exceptionAsArray ( Exception  $e)
protected

Convert an exception to an array of structured data.

Parameters
Exception$e
Returns
array

Definition at line 112 of file LineFormatter.php.

References $e, $out, and MWExceptionHandler\redactTrace().

Referenced by MediaWiki\Logger\Monolog\LineFormatter\normalizeException().

◆ format()

MediaWiki\Logger\Monolog\LineFormatter::format ( array  $record)

◆ normalizeException()

MediaWiki\Logger\Monolog\LineFormatter::normalizeException (   $e)
protected

Convert an Exception to a string.

Parameters
Exception$e
Returns
string

Definition at line 102 of file LineFormatter.php.

References $e, MediaWiki\Logger\Monolog\LineFormatter\exceptionAsArray(), and MediaWiki\Logger\Monolog\LineFormatter\normalizeExceptionArray().

Referenced by MediaWiki\Logger\Monolog\LineFormatter\format().

◆ normalizeExceptionArray()

MediaWiki\Logger\Monolog\LineFormatter::normalizeExceptionArray ( array  $e)
protected

Convert an array of Exception data to a string.

Parameters
array$e
Returns
string

Definition at line 136 of file LineFormatter.php.

References $e, and MWExceptionHandler\prettyPrintTrace().

Referenced by MediaWiki\Logger\Monolog\LineFormatter\format(), and MediaWiki\Logger\Monolog\LineFormatter\normalizeException().


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