add the logfile entry to common, a little recoding in common_log
darcs-hash:20080712151521-84dde-a81c53bacbe15e77b70fc460ad9143e7e4f8402c.gz
This commit is contained in:
parent
74c3b9de23
commit
a25f5010e6
|
@ -40,6 +40,7 @@ $config =
|
||||||
'server' => 'localhost',
|
'server' => 'localhost',
|
||||||
'theme' => 'default',
|
'theme' => 'default',
|
||||||
'path' => '/',
|
'path' => '/',
|
||||||
|
'logfile' => NULL,
|
||||||
'fancy' => false,
|
'fancy' => false,
|
||||||
'email' => $_SERVER['SERVER_ADMIN'],
|
'email' => $_SERVER['SERVER_ADMIN'],
|
||||||
'broughtby' => NULL,
|
'broughtby' => NULL,
|
||||||
|
|
14
lib/util.php
14
lib/util.php
|
@ -1063,16 +1063,20 @@ function common_ensure_syslog() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function common_log($priority, $msg, $filename=NULL) {
|
function common_log($priority, $msg, $filename=NULL) {
|
||||||
common_ensure_syslog();
|
$logfile = common_config('site', 'logfile');
|
||||||
syslog($priority, $msg);
|
if ($logfile) {
|
||||||
global $config;
|
$log = fopen($logfile, "a");
|
||||||
$log = fopen($config['site']['logfile'], "a");
|
|
||||||
if ($log) {
|
if ($log) {
|
||||||
$syslog_priorities = array('LOG_EMERG', 'LOG_ALERT', 'LOG_CRIT', 'LOG_ERR', 'LOG_WARNING', 'LOG_NOTICE', 'LOG_INFO', 'LOG_DEBUG');
|
static $syslog_priorities = array('LOG_EMERG', 'LOG_ALERT', 'LOG_CRIT', 'LOG_ERR',
|
||||||
|
'LOG_WARNING', 'LOG_NOTICE', 'LOG_INFO', 'LOG_DEBUG');
|
||||||
$output = date('Y-m-d H:i:s') . ' ' . $syslog_priorities[$priority] . ': ' . $msg . "\n";
|
$output = date('Y-m-d H:i:s') . ' ' . $syslog_priorities[$priority] . ': ' . $msg . "\n";
|
||||||
fwrite($log, $output);
|
fwrite($log, $output);
|
||||||
fclose($log);
|
fclose($log);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
common_ensure_syslog();
|
||||||
|
syslog($priority, $msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function common_debug($msg, $filename=NULL) {
|
function common_debug($msg, $filename=NULL) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user