summaryrefslogtreecommitdiffstats
path: root/inc/eventlog.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/eventlog.inc.php')
-rw-r--r--inc/eventlog.inc.php25
1 files changed, 19 insertions, 6 deletions
diff --git a/inc/eventlog.inc.php b/inc/eventlog.inc.php
index 3ebb82a4..a29261b8 100644
--- a/inc/eventlog.inc.php
+++ b/inc/eventlog.inc.php
@@ -17,12 +17,14 @@ class EventLog
error_log($message);
return;
}
+ $data = [
+ 'type' => $type,
+ 'message' => $message,
+ 'details' => $details
+ ];
Database::exec("INSERT INTO eventlog (dateline, logtypeid, description, extra)"
- . " VALUES (UNIX_TIMESTAMP(), :type, :message, :details)", array(
- 'type' => $type,
- 'message' => $message,
- 'details' => $details
- ), true);
+ . " VALUES (UNIX_TIMESTAMP(), :type, :message, :details)", $data, true);
+ self::applyFilterRules('#serverlog', $data);
}
public static function failure($message, $details = '')
@@ -51,5 +53,16 @@ class EventLog
return;
Database::exec("TRUNCATE eventlog");
}
-
+
+ /**
+ * @param string $type the event. Will either be client state like ~poweron, ~runstate etc. or a client log type
+ * @param array $data A structured array containing event specific data that can be matched.
+ */
+ public static function applyFilterRules(string $type, array $data)
+ {
+ if (!Module::isAvailable('eventlog'))
+ return;
+ FilterRuleProcessor::applyFilterRules($type, $data);
+ }
+
}