<?php
/*
* Article System
* Online journal management tool written in PHP/MySQL/PostgreSQL.
* This code is available at http://sourceforge.net/projects/artsys
*
* Copyright (C) 2001-2005 Jan Hnatek
* Distributed under the terms of the GNU General Public License
*
* Date: 05/08/2005
* Version: 0.6
*/
###############################################################################
# logging system
#
// include log object, do not (re)move
require_once INCLUDE_DIR ."/classes/log/class.mlog.php";
require_once INCLUDE_DIR ."/classes/log/class.as_mlog.php";
// logging destinations setup
// see mlog class documentation for list of destinations
$MLOG_DEST = array (
"file" => array (MLOG_WARNING, MLOG_ERROR),
"email" => array (MLOG_WARNING, MLOG_ERROR),
"syslog" => array (MLOG_WARNING, MLOG_ERROR),
"host" => array (MLOG_WARNING, MLOG_ERROR),
);
// create log object with given debug level
eval ("\$debug_level = {$config["debug_level"]};");
$mlog = new as_mlog ($debug_level);
// enable all non-empty destinations
if (!empty ($LOG_FILE))
$mlog->set_logfile ($LOG_FILE, $MLOG_DEST['file']);
if (!empty ($LOG_EMAIL))
$mlog->set_email ($LOG_EMAIL, $LOG_EMAIL_HEADERS, $MLOG_DEST['email']);
if (!empty ($LOG_SYSLOG))
$mlog->set_syslog ($MLOG_DEST['syslog']);
if (!empty ($LOG_HOST))
$mlog->set_debug_host ($LOG_HOST, $MLOG_DEST['debug_host']);
// global log interface
function debug ($text) { $GLOBALS['mlog']->message ($text, MLOG_DEBUG); }
function debug_db ($text) { $GLOBALS['mlog']->message ($text, MLOG_DEBUG_DB); }
function debug_db_massive ($text) { $GLOBALS['mlog']->message ($text, MLOG_DEBUG_DB_MASSIVE); }
function adebug ($var) { echo "<pre>"; print_r ($var); echo "</pre>\n"; }
// exported messages -> msg used
function notice ($text) { $GLOBALS['mlog']->message ($text, MLOG_NOTICE); }
function info ($text) { $GLOBALS['mlog']->message ($text, MLOG_NOTICE); }
function warning ($text) { $GLOBALS['mlog']->message ($text, MLOG_WARNING); }
function error ($text) { $GLOBALS['mlog']->message ($text, MLOG_ERROR); }
function failexit ($text) { $GLOBALS['mlog']->message ($text, MLOG_ERROR); exit; }
function conderror ($cond, $output, $file="") {
if (!$cond)
if (!$file)
failexit ("Assertion failed: <b>$output</b>, exiting ...<br>\n");
else
failexit ("Assertion failed in $file:<br><b>$output</b>, exiting ...<br>\n");
}
?>