summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorzach <zach@copley.name>2008-07-11 03:00:21 -0400
committerzach <zach@copley.name>2008-07-11 03:00:21 -0400
commit74c3b9de236b61e731cbdca6564fba773b34a23b (patch)
tree5855fc811fdfba4dba38ded2df4b46f90d41f65d /lib
parent378985a4d6918cf725d077eb1b47ac8643d61dfd (diff)
Log msgs can now go to a file as well as syslog
darcs-hash:20080711070021-ca946-8f8f385ddacc098c8a0c2627e3a8690a9f3aa2c7.gz
Diffstat (limited to 'lib')
-rw-r--r--lib/util.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/util.php b/lib/util.php
index 512f2dece..8b17d873b 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -1065,6 +1065,14 @@ function common_ensure_syslog() {
function common_log($priority, $msg, $filename=NULL) {
common_ensure_syslog();
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) {