summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2009-12-05 02:11:27 -0500
committerCraig Andrews <candrews@integralblue.com>2009-12-05 02:11:27 -0500
commit2ab01e040e224943b1b15131a6e51fe6b5d6e580 (patch)
tree6194773ac15fd37ee93050d744a8be3b2f6d8ade /lib
parent51f0dd5e37db0e8d2a8690655555d399249942df (diff)
Add 2 new events to enable logger pluginization: StartLog and EndLog
Diffstat (limited to 'lib')
-rw-r--r--lib/util.php25
1 files changed, 14 insertions, 11 deletions
diff --git a/lib/util.php b/lib/util.php
index ab046e871..14d666503 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -1070,18 +1070,21 @@ function common_request_id()
function common_log($priority, $msg, $filename=null)
{
- $msg = '[' . common_request_id() . '] ' . $msg;
- $logfile = common_config('site', 'logfile');
- if ($logfile) {
- $log = fopen($logfile, "a");
- if ($log) {
- $output = common_log_line($priority, $msg);
- fwrite($log, $output);
- fclose($log);
+ if(Event::handle('StartLog', array(&$priority, &$msg, &$filename))){
+ $msg = '[' . common_request_id() . '] ' . $msg;
+ $logfile = common_config('site', 'logfile');
+ if ($logfile) {
+ $log = fopen($logfile, "a");
+ if ($log) {
+ $output = common_log_line($priority, $msg);
+ fwrite($log, $output);
+ fclose($log);
+ }
+ } else {
+ common_ensure_syslog();
+ syslog($priority, $msg);
}
- } else {
- common_ensure_syslog();
- syslog($priority, $msg);
+ Event::handle('EndLog', array($priority, $msg, $filename));
}
}