diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-05-11 12:59:42 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-05-11 12:59:42 +0000 |
commit | 0cd1863fbcc90606d53464c80d64234792497758 (patch) | |
tree | 978bfb69b6797ac3db25a4a7d013a879452b91c4 /engine | |
parent | d742ec2f2062d35513a7c6250e0bcc83b9936693 (diff) | |
download | elgg-0cd1863fbcc90606d53464c80d64234792497758.tar.gz elgg-0cd1863fbcc90606d53464c80d64234792497758.tar.bz2 |
Closes #1010: Log event now called on an event of its own, this permits plugins to add additional logging or replace the logging method altogether.
This is only possible now that the old river code has been replaced.
git-svn-id: https://code.elgg.org/elgg/trunk@3278 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r-- | engine/lib/system_log.php | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/engine/lib/system_log.php b/engine/lib/system_log.php index b500c573b..71996c8b3 100644 --- a/engine/lib/system_log.php +++ b/engine/lib/system_log.php @@ -257,6 +257,21 @@ return false;
return true;
+ } + + /** + * Default system log handler, allows plugins to override, extend or disable logging. + * + * @param string $event + * @param string $object_type + * @param Loggable $object + * @return unknown + */ + function system_log_default_logger($event, $object_type, $object) + { + system_log($object['object'], $object['event']); + + return true; }
/**
@@ -265,16 +280,20 @@ *
* @param String $event
* @param String $object_type
- * @param mixed $object
+ * @param Loggable $object
*/
function system_log_listener($event, $object_type, $object)
- {
- system_log($object, $event);
+ { + if (($object_type!='systemlog') && ($event!='log'))
+ trigger_elgg_event('log', 'systemlog', array('object' => $object, 'event' => $event));
return true;
}
/** Register event to listen to all events **/
- register_elgg_event_handler('all','all','system_log_listener', 400);
+ register_elgg_event_handler('all','all','system_log_listener', 400); + + /** Register a default system log handler */ + register_elgg_event_handler('log','systemlog','system_log_default_logger', 999);
?>
\ No newline at end of file |