MediaWiki master
MediaWiki\Logger\Monolog\LineFormatter Class Reference

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

Inherits MonologLineFormatter.

Collaboration diagram for MediaWiki\Logger\Monolog\LineFormatter:

Public Member Functions

 __construct ( $format=null, $dateFormat=null, $allowInlineLineBreaks=false, $ignoreEmptyContextAndExtra=false, $includeStacktraces=false)
 
 format (array $record)
 

Protected Member Functions

 exceptionAsArray (Throwable $e)
 Convert a throwable to an array of structured data.
 
 normalizeException (Throwable $e, int $depth=0)
 Convert a Throwable to a string.
 
 normalizeExceptionArray (array $e)
 Convert an array of Throwable data to a string.
 

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.

Throwables 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
Note
© 2015 Wikimedia Foundation and contributors

Definition at line 44 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 | null$formatThe format of the message
string | null$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 53 of file LineFormatter.php.

Member Function Documentation

◆ exceptionAsArray()

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

Convert a throwable to an array of structured data.

Parameters
Throwable$e
Returns
array

Definition at line 115 of file LineFormatter.php.

◆ format()

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

◆ normalizeException()

MediaWiki\Logger\Monolog\LineFormatter::normalizeException ( Throwable $e,
int $depth = 0 )
protected

Convert a Throwable to a string.

Parameters
Throwable$e
int$depth
Returns
string

Definition at line 104 of file LineFormatter.php.

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

◆ normalizeExceptionArray()

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

Convert an array of Throwable data to a string.

Parameters
array$e
Returns
string

Definition at line 139 of file LineFormatter.php.

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


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