24use Monolog\Formatter\LineFormatter as MonologLineFormatter;
52 $format =
null, $dateFormat =
null, $allowInlineLineBreaks =
false,
53 $ignoreEmptyContextAndExtra =
false, $includeStacktraces =
false
56 $format, $dateFormat, $allowInlineLineBreaks,
57 $ignoreEmptyContextAndExtra
59 $this->includeStacktraces( $includeStacktraces );
65 public function format( array $record ) {
67 unset( $record[
'context'][
'private'] );
71 $prettyException =
'';
72 if ( isset( $record[
'context'][
'exception'] ) &&
73 strpos( $this->format,
'%exception%' ) !==
false
75 $e = $record[
'context'][
'exception'];
76 unset( $record[
'context'][
'exception'] );
78 if (
$e instanceof Exception ) {
80 } elseif ( is_array(
$e ) ) {
83 $prettyException = $this->stringify(
$e );
87 $output = parent::format( $record );
89 if ( strpos(
$output,
'%exception%' ) !==
false ) {
113 'class' => get_class(
$e ),
114 'message' =>
$e->getMessage(),
115 'code' =>
$e->getCode(),
116 'file' =>
$e->getFile(),
117 'line' =>
$e->getLine(),
121 $prev =
$e->getPrevious();
137 'class' =>
'Unknown',
140 'message' =>
'unknown',
143 $e = array_merge( $defaults,
$e );
145 $str =
"\n[Exception {$e['class']}] (" .
146 "{$e['file']}:{$e['line']}) {$e['message']}";
148 if ( $this->includeStacktraces &&
$e[
'trace'] ) {
153 if ( isset(
$e[
'previous'] ) ) {
154 $prev =
$e[
'previous'];
156 $prev = array_merge( $defaults, $prev );
157 $str .=
"\nCaused by: [Exception {$prev['class']}] (" .
158 "{$prev['file']}:{$prev['line']}) {$prev['message']}";
160 if ( $this->includeStacktraces && $prev[
'trace'] ) {
167 $prev = isset( $prev[
'previous'] ) ? $prev[
'previous'] :
null;
Handler class for MWExceptions.
static prettyPrintTrace(array $trace, $pad='')
Generate a string representation of a stacktrace.
static redactTrace(array $trace)
Redact a stacktrace generated by Exception::getTrace(), debug_backtrace() or similar means.
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title after the basic globals have been set but before ordinary actions take place $output
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
returning false will NOT prevent logging $e