Ejemplo n.º 1
0
/* The $vmLogIdentifier is intended to separate different sources of logging
   information - such as VirtueMart itself, or external apps like the PayPal
   notification script (notify.php).
*/
if (!isset($vmLogIdentifier)) {
    $vmLogIdentifier = '';
}
/* The existing display logger starts out with a log level of PEAR_LOG_TIP.
   However, no debug-levwel output will be sent to the display unless the DEBUG
   option is turned on inside the VM admin configuration panel. */
$vmDisplayLoggerConf = array('buffering' => true);
$vmDisplayLogger =& vmLog::singleton('display', '', $vmLogIdentifier, $vmDisplayLoggerConf, PEAR_LOG_TIP);
/* Use a null logger if file logging is disabled or if there is an error.  This
   is so that code using the logger will continue to work without problem. */
if (VM_LOGFILE_ENABLED != '1') {
    $vmFileLogger =& vmLog::singleton('null');
} else {
    $vmFileLoggerConf = array('mode' => 0600, 'timeFormat' => '%X %x', 'lineFormat' => VM_LOGFILE_FORMAT);
    $vmFileLogger =& vmLog::singleton('file', VM_LOGFILE_NAME, $vmLogIdentifier, $vmFileLoggerConf, vmLog::stringToPriorityPEAR(VM_LOGFILE_LEVEL));
    if ($vmFileLogger == false) {
        $vmDisplayLogger->warning($VM_LANG->_VM_ADMIN_CFG_LOGFILE_ERROR);
        $vmFileLogger =& vmLog::singleton('null');
    }
}
$vmLogger =& vmLog::singleton('composite');
$vmLogger->addChild($vmDisplayLogger);
$vmLogger->addChild($vmFileLogger);
$vmLogger->open();
$GLOBALS['vmLogger'] =& $vmLogger;
$GLOBALS['vmDisplayLogger'] =& $vmDisplayLogger;
$GLOBALS['vmFileLogger'] =& $vmFileLogger;