Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Monolog/Processor/ExceptionToTextProcessor.php')
-rw-r--r--plugins/Monolog/Processor/ExceptionToTextProcessor.php17
1 files changed, 12 insertions, 5 deletions
diff --git a/plugins/Monolog/Processor/ExceptionToTextProcessor.php b/plugins/Monolog/Processor/ExceptionToTextProcessor.php
index 686fd92644..b4345f650a 100644
--- a/plugins/Monolog/Processor/ExceptionToTextProcessor.php
+++ b/plugins/Monolog/Processor/ExceptionToTextProcessor.php
@@ -20,6 +20,13 @@ use Piwik\SettingsPiwik;
*/
class ExceptionToTextProcessor
{
+ private $forcePrintBacktrace = false;
+
+ public function __construct($forcePrintBacktrace = false)
+ {
+ $this->forcePrintBacktrace = $forcePrintBacktrace;
+ }
+
public function __invoke(array $record)
{
if (! $this->contextContainsException($record)) {
@@ -34,10 +41,9 @@ class ExceptionToTextProcessor
}
$exceptionStr = sprintf(
- "%s(%d): %s\n%s",
+ "%s(%d): %s",
$exception instanceof \Exception ? $exception->getFile() : $exception['file'],
$exception instanceof \Exception ? $exception->getLine() : $exception['line'],
- $this->getMessage($exception),
$this->getStackTrace($exception)
);
@@ -79,7 +85,7 @@ class ExceptionToTextProcessor
private function getStackTrace($exception)
{
- return Log::$debugBacktraceForTests ?: self::getMessageAndWholeBacktrace($exception);
+ return Log::$debugBacktraceForTests ?: self::getMessageAndWholeBacktrace($exception, $this->forcePrintBacktrace ? true : null);
}
/**
@@ -94,12 +100,13 @@ class ExceptionToTextProcessor
}
if (is_array($exception)) {
+ $message = $exception['message'] ?? '';
if ($shouldPrintBacktrace && isset($exception['backtrace'])) {
$trace = $exception['backtrace'];
$trace = self::replaceSensitiveValues($trace);
- return $trace;
+ return $message . "\n" . $trace;
} else {
- return '';
+ return $message;
}
}