Log msgs can now go to a file as well as syslog
darcs-hash:20080711070021-ca946-8f8f385ddacc098c8a0c2627e3a8690a9f3aa2c7.gz
This commit is contained in:
parent
378985a4d6
commit
74c3b9de23
|
@ -24,6 +24,9 @@ $config['site']['path'] = 'laconica';
|
||||||
#$config['site']['broughtby'] = 'Individual or Company';
|
#$config['site']['broughtby'] = 'Individual or Company';
|
||||||
#$config['site']['broughtbyurl'] = 'http://example.net/';
|
#$config['site']['broughtbyurl'] = 'http://example.net/';
|
||||||
|
|
||||||
|
# If you want logging sent to a file in addition to syslog
|
||||||
|
#$config['site']['logfile'] = '/tmp/laconica.log';
|
||||||
|
|
||||||
# This is a PEAR DB DSN, see http://pear.php.net/manual/en/package.database.db.intro-dsn.php
|
# This is a PEAR DB DSN, see http://pear.php.net/manual/en/package.database.db.intro-dsn.php
|
||||||
# Set it to match your actual database
|
# Set it to match your actual database
|
||||||
|
|
||||||
|
|
|
@ -1065,6 +1065,14 @@ function common_ensure_syslog() {
|
||||||
function common_log($priority, $msg, $filename=NULL) {
|
function common_log($priority, $msg, $filename=NULL) {
|
||||||
common_ensure_syslog();
|
common_ensure_syslog();
|
||||||
syslog($priority, $msg);
|
syslog($priority, $msg);
|
||||||
|
global $config;
|
||||||
|
$log = fopen($config['site']['logfile'], "a");
|
||||||
|
if ($log) {
|
||||||
|
$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";
|
||||||
|
fwrite($log, $output);
|
||||||
|
fclose($log);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function common_debug($msg, $filename=NULL) {
|
function common_debug($msg, $filename=NULL) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user