From ea40a9cd936e3e6cd0b5ac1c29d32112e7985247 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 4 Jun 2008 22:47:17 -0400 Subject: [PATCH] move filename stuff to debug function darcs-hash:20080605024717-84dde-dc897a855af13ea30bb670daf94749e9f14fa7ad.gz --- lib/common.php | 4 +++- lib/util.php | 12 +++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/common.php b/lib/common.php index b2c0a7b464..f910b36135 100644 --- a/lib/common.php +++ b/lib/common.php @@ -35,10 +35,12 @@ require_once('DB/DataObject/Cast.php'); # for dates $config = array('site' => array('name' => 'Just another Laconica microblog', - 'appname' => 'laconica', # for syslog 'server' => 'localhost', 'path' => '/', 'fancy' => false), + 'syslog' => + array('appname' => 'laconica', # for syslog + 'priority' => 'debug'), # XXX: currently ignored 'tag' => array('authority' => 'INVALID TAG', 'date' => 'PUT A DATE HERE', diff --git a/lib/util.php b/lib/util.php index 7171211da3..03b1e42a90 100644 --- a/lib/util.php +++ b/lib/util.php @@ -577,20 +577,22 @@ function common_ensure_syslog() { if (!$initialized) { global $config; define_syslog_variables(); - openlog($config['site']['appname'], 0, LOG_USER); + openlog($config['syslog']['appname'], 0, LOG_USER); $initialized = true; } } function common_log($priority, $msg, $filename=NULL) { common_ensure_syslog(); - if ($filename) { - syslog($priority, basename($filename).' - '.$msg); - } + syslog($priority, $msg); } function common_debug($msg, $filename=NULL) { - common_log(LOG_DEBUG, $msg, $filename); + if ($filename) { + common_log(LOG_DEBUG, basename($filename).' - '.$msg); + } else { + common_log(LOG_DEBUG, $msg); + } } function common_valid_http_url($url) {