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:
authordiosmosis <diosmosis@users.noreply.github.com>2019-08-17 05:26:59 +0300
committerGitHub <noreply@github.com>2019-08-17 05:26:59 +0300
commit9f6197a780eabb0322741b41407af0e4500b7a96 (patch)
tree1f12db28ca87107dd046774601611d0234fe7cc8 /plugins/Monolog
parent9a7c8eda0b1b2918c8cbb6d18d7ea47027337374 (diff)
Add some debugging info to log notifications so they can be more easily reproduced. (#14753)
* Add some debugging info to log notifications so they can be more easily reproduced. * Only put debugging info if piece of info is present.
Diffstat (limited to 'plugins/Monolog')
-rw-r--r--plugins/Monolog/Handler/WebNotificationHandler.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/plugins/Monolog/Handler/WebNotificationHandler.php b/plugins/Monolog/Handler/WebNotificationHandler.php
index a71b0ff28e..c56e2d54e4 100644
--- a/plugins/Monolog/Handler/WebNotificationHandler.php
+++ b/plugins/Monolog/Handler/WebNotificationHandler.php
@@ -47,6 +47,7 @@ class WebNotificationHandler extends AbstractProcessingHandler
}
$message = $record['level_name'] . ': ' . htmlentities($record['message'], ENT_COMPAT | ENT_HTML401, 'UTF-8');
+ $message .= $this->getLiteDebuggingInfo();
$notification = new Notification($message);
$notification->context = $context;
@@ -58,4 +59,30 @@ class WebNotificationHandler extends AbstractProcessingHandler
// Silently ignore the error.
}
}
+
+ private function getLiteDebuggingInfo()
+ {
+ $info = [
+ 'Module' => Common::getRequestVar('module', false),
+ 'Action' => Common::getRequestVar('action', false),
+ 'Method' => Common::getRequestVar('method', false),
+ 'Trigger' => Common::getRequestVar('trigger', false),
+ 'In CLI mode' => Common::isPhpCliMode() ? 'true' : 'false',
+ ];
+
+ $parts = [];
+ foreach ($info as $title => $value) {
+ if (empty($value)) {
+ continue;
+ }
+
+ $parts[] = "$title: $value";
+ }
+
+ if (empty($parts)) {
+ return "";
+ }
+
+ return "\n(" . implode(', ', $parts) . ")";
+ }
}