Add 2 new events to enable logger pluginization: StartLog and EndLog
This commit is contained in:
parent
51f0dd5e37
commit
2ab01e040e
11
EVENTS.txt
11
EVENTS.txt
|
@ -617,3 +617,14 @@ EndInlineScriptElement: After a <script...> element is written
|
|||
- $action
|
||||
- $code
|
||||
- $type
|
||||
|
||||
StartLog: Before writing to the logs
|
||||
- &$priority
|
||||
- &$msg
|
||||
- &$filename
|
||||
|
||||
EndLog: After writing to the logs
|
||||
- $priority
|
||||
- $msg
|
||||
- $filename
|
||||
|
||||
|
|
|
@ -1070,6 +1070,7 @@ function common_request_id()
|
|||
|
||||
function common_log($priority, $msg, $filename=null)
|
||||
{
|
||||
if(Event::handle('StartLog', array(&$priority, &$msg, &$filename))){
|
||||
$msg = '[' . common_request_id() . '] ' . $msg;
|
||||
$logfile = common_config('site', 'logfile');
|
||||
if ($logfile) {
|
||||
|
@ -1083,6 +1084,8 @@ function common_log($priority, $msg, $filename=null)
|
|||
common_ensure_syslog();
|
||||
syslog($priority, $msg);
|
||||
}
|
||||
Event::handle('EndLog', array($priority, $msg, $filename));
|
||||
}
|
||||
}
|
||||
|
||||
function common_debug($msg, $filename=null)
|
||||
|
|
Loading…
Reference in New Issue
Block a user