We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 2ab01e04 authored by Craig Andrews's avatar Craig Andrews

Add 2 new events to enable logger pluginization: StartLog and EndLog

parent 51f0dd5e
......@@ -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,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));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment