diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2019-08-17 05:26:59 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-17 05:26:59 +0300 |
commit | 9f6197a780eabb0322741b41407af0e4500b7a96 (patch) | |
tree | 1f12db28ca87107dd046774601611d0234fe7cc8 /plugins/Monolog | |
parent | 9a7c8eda0b1b2918c8cbb6d18d7ea47027337374 (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.php | 27 |
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) . ")"; + } } |