aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2022-01-30 17:28:16 +0100
committerAndreas Gohr <andi@splitbrain.org>2022-01-30 17:28:16 +0100
commit4b647920082baae0eede287b564b30ccb4d68796 (patch)
treecc4cd9c76ed7c52ac7e5784aae22f34da2756e50
parent4ef5d38db53e045a81f129b29a8b886cecc38497 (diff)
downloaddokuwiki-logunevent.tar.gz
dokuwiki-logunevent.zip
Ignore missing event system in logging #3614logunevent
-rw-r--r--inc/Logger.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/inc/Logger.php b/inc/Logger.php
index b7cb062a4..0772305f3 100644
--- a/inc/Logger.php
+++ b/inc/Logger.php
@@ -111,6 +111,7 @@ class Logger
*/
public function log($message, $details = null, $file = '', $line = 0)
{
+ global $EVENT_HANDLER;
if (!$this->isLogging) return false;
$datetime = time();
@@ -124,12 +125,18 @@ class Logger
'loglines' => [],
'logfile' => $this->getLogfile($datetime),
];
- $event = new Event('LOGGER_DATA_FORMAT', $data);
- if ($event->advise_before()) {
+ if ($EVENT_HANDLER !== null) {
+ $event = new Event('LOGGER_DATA_FORMAT', $data);
+ if ($event->advise_before()) {
+ $data['loglines'] = $this->formatLogLines($data);
+ }
+ $event->advise_after();
+ } else {
+ // The event system is not yet available, to ensure the log isn't lost even on
+ // fatal errors, the default action is executed
$data['loglines'] = $this->formatLogLines($data);
}
- $event->advise_after();
// only log when any data available
if (count($data['loglines'])) {