コード例 #1
0
ファイル: syslog.php プロジェクト: BackupTheBerlios/kmit-svn
 /**
  * Constructs a new syslog object.
  *
  * @param string $name     The syslog facility.
  * @param string $ident    The identity string.
  * @param array  $conf     The configuration array.
  * @param int    $level    Log messages up to and including this level.
  * @access public
  */
 function vmLog_syslog($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     /* Ensure we have a valid integer value for $name. */
     if (empty($name) || !is_int($name)) {
         $name = vmLog_syslog;
     }
     $this->_id = md5(microtime());
     $this->_name = $name;
     $this->_ident = $ident;
     $this->_mask = vmLog::UPTO($level);
 }
コード例 #2
0
ファイル: display.php プロジェクト: BackupTheBerlios/kmit-svn
 /**
  * Constructs a new vmLog_display object.
  *
  * @param string $name     Ignored.
  * @param string $ident    The identity string.
  * @param array  $conf     The configuration array.
  * @param int    $level    Log messages up to and including this level.
  * @access public
  */
 function vmLog_display($name = '', $ident = '', $conf = array(), $level = PEAR_LOG_TIP)
 {
     $this->_id = md5(microtime());
     $this->_ident = $ident;
     $this->_mask = vmLog::UPTO($level);
     if (isset($conf['linebreak'])) {
         $this->_linebreak = $conf['linebreak'];
     }
     if (isset($conf['buffering'])) {
         $this->_buffering = $conf['buffering'];
     }
 }
コード例 #3
0
ファイル: error_log.php プロジェクト: noikiy/owaspbwa
 /**
  * Constructs a new vmLog_error_log object.
  *
  * @param string $name     Ignored.
  * @param string $ident    The identity string.
  * @param array  $conf     The configuration array.
  * @param int    $level    Log messages up to and including this level.
  * @access public
  */
 function vmLog_error_log($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_type = $name;
     $this->_ident = $ident;
     $this->_mask = vmLog::UPTO($level);
     if (!empty($conf['destination'])) {
         $this->_destination = $conf['destination'];
     }
     if (!empty($conf['extra_headers'])) {
         $this->_extra_headers = $conf['extra_headers'];
     }
 }
コード例 #4
0
ファイル: win.php プロジェクト: BackupTheBerlios/kmit-svn
 /**
  * Constructs a new vmLog_win object.
  *
  * @param string $name     Ignored.
  * @param string $ident    The identity string.
  * @param array  $conf     The configuration array.
  * @param int    $level    Log messages up to and including this level.
  * @access public
  */
 function vmLog_win($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_name = $name;
     $this->_ident = $ident;
     $this->_mask = vmLog::UPTO($level);
     if (isset($conf['title'])) {
         $this->_title = $conf['title'];
     }
     if (isset($conf['colors']) && is_array($conf['colors'])) {
         $this->_colors = $conf['colors'];
     }
     register_shutdown_function(array(&$this, '_vmLog_win'));
 }
コード例 #5
0
ファイル: mail.php プロジェクト: noikiy/owaspbwa
 /**
  * Writes $message to the currently open mail message.
  * Calls open(), if necessary.
  *
  * @param mixed  $message  String or object containing the message to log.
  * @param string $priority The priority of the message.  Valid
  *                  values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,
  *                  PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,
  *                  PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.
  * @return boolean  True on success or false on failure.
  * @access public
  */
 function log($message, $priority = null)
 {
     /* If a priority hasn't been specified, use the default value. */
     if ($priority === null) {
         $priority = $this->_priority;
     }
     /* Abort early if the priority is above the maximum logging level. */
     if (!$this->_isMasked($priority)) {
         return false;
     }
     /* If the message isn't open and can't be opened, return failure. */
     if (!$this->_opened && !$this->open()) {
         return false;
     }
     /* Extract the string representation of the message. */
     $message = $this->_extractMessage($message);
     $entry = sprintf("%s %s [%s] %s\r\n", strftime('%b %d %H:%M:%S'), $this->_ident, vmLog::priorityToString($priority), $message);
     $this->_message .= $entry;
     $this->_announce(array('priority' => $priority, 'message' => $message));
     return true;
 }
コード例 #6
0
ファイル: null.php プロジェクト: noikiy/owaspbwa
 /**
  * Constructs a new vmLog_null object.
  *
  * @param string $name     Ignored.
  * @param string $ident    The identity string.
  * @param array  $conf     The configuration array.
  * @param int    $level    Log messages up to and including this level.
  * @access public
  */
 function vmLog_null($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_ident = $ident;
     $this->_mask = vmLog::UPTO($level);
 }
コード例 #7
0
 /**
  * Sets this identification string for all of this composite's children.
  *
  * @param string    $ident      The new identification string.
  *
  * @access public
  * @since  Log 1.6.7
  */
 function setIdent($ident)
 {
     /* Call our base class's setIdent() method. */
     parent::setIdent($ident);
     /* ... and then call setIdent() on all of our children. */
     foreach ($this->_children as $id => $child) {
         $this->_children[$id]->setIdent($ident);
     }
 }
コード例 #8
0
ファイル: Log.php プロジェクト: BackupTheBerlios/kmit-svn
 /**
  * Check if the given priority is included in the current level mask.
  *
  * @param integer   $priority   The priority to check.
  *
  * @return boolean  True if the given priority is included in the current
  *                  log mask.
  *
  * @access  private
  * @since   Log 1.7.0
  */
 function _isMasked($priority)
 {
     return vmLog::MASK($priority) & $this->_mask;
 }
コード例 #9
0
ファイル: daemon.php プロジェクト: noikiy/owaspbwa
 /**
  * Constructs a new syslog object.
  *
  * @param string $name     The syslog facility.
  * @param string $ident    The identity string.
  * @param array  $conf     The configuration array.
  * @param int    $maxLevel Maximum level at which to log.
  * @access public
  */
 function vmLog_daemon($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     /* Ensure we have a valid integer value for $name. */
     if (empty($name) || !is_int($name)) {
         $name = LOG_SYSLOG;
     }
     $this->_id = md5(microtime());
     $this->_name = $name;
     $this->_ident = $ident;
     $this->_mask = vmLog::UPTO($level);
     if (isset($conf['ip'])) {
         $this->_ip = $conf['ip'];
     }
     if (isset($conf['proto'])) {
         $this->_proto = $conf['proto'];
     }
     if (isset($conf['port'])) {
         $this->_port = $conf['port'];
     }
     if (isset($conf['maxsize'])) {
         $this->_maxsize = $conf['maxsize'];
     }
     if (isset($conf['timeout'])) {
         $this->_timeout = $conf['timeout'];
     }
     $this->_proto = $this->_proto . '://';
     register_shutdown_function(array(&$this, '_vmLog_daemon'));
 }
コード例 #10
0
ファイル: mcal.php プロジェクト: noikiy/owaspbwa
 /**
  * Constructs a new vmLog_mcal object.
  *
  * @param string $name     The category to use for our events.
  * @param string $ident    The identity string.
  * @param array  $conf     The configuration array.
  * @param int    $level    Log messages up to and including this level.
  * @access public
  */
 function vmLog_mcal($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_name = $name;
     $this->_ident = $ident;
     $this->_mask = vmLog::UPTO($level);
     $this->_calendar = $conf['calendar'];
     $this->_username = $conf['username'];
     $this->_password = $conf['password'];
     $this->_options = $conf['options'];
 }
コード例 #11
0
ファイル: file.php プロジェクト: noikiy/owaspbwa
 /**
  * Constructs a new vmLog_file object.
  *
  * @param string $name     Ignored.
  * @param string $ident    The identity string.
  * @param array  $conf     The configuration array.
  * @param int    $level    Log messages up to and including this level.
  * @access public
  */
 function vmLog_file($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_filename = $name;
     $this->_ident = $ident;
     $this->_mask = vmLog::UPTO($level);
     if (isset($conf['append'])) {
         $this->_append = $conf['append'];
     }
     if (isset($conf['locking'])) {
         $this->_locking = $conf['locking'];
     }
     if (!empty($conf['mode'])) {
         if (is_string($conf['mode'])) {
             $this->_mode = octdec($conf['mode']);
         } else {
             $this->_mode = $conf['mode'];
         }
     }
     if (!empty($conf['dirmode'])) {
         if (is_string($conf['dirmode'])) {
             $this->_dirmode = octdec($conf['dirmode']);
         } else {
             $this->_dirmode = $conf['dirmode'];
         }
     }
     if (!empty($conf['lineFormat'])) {
         $this->_lineFormat = str_replace(array_keys($this->_formatMap), array_values($this->_formatMap), $conf['lineFormat']);
     }
     if (!empty($conf['timeFormat'])) {
         $this->_timeFormat = $conf['timeFormat'];
     }
     if (!empty($conf['eol'])) {
         $this->_eol = $conf['eol'];
     } else {
         $this->_eol = strstr(PHP_OS, 'WIN') ? "\r\n" : "\n";
     }
     register_shutdown_function(array(&$this, '_vmLog_file'));
 }
コード例 #12
0
ファイル: console.php プロジェクト: noikiy/owaspbwa
 /**
  * Constructs a new vmLog_console object.
  * 
  * @param string $name     Ignored.
  * @param string $ident    The identity string.
  * @param array  $conf     The configuration array.
  * @param int    $level    Log messages up to and including this level.
  * @access public
  */
 function vmLog_console($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_ident = $ident;
     $this->_mask = vmLog::UPTO($level);
     if (!empty($conf['stream'])) {
         $this->_stream = $conf['stream'];
     }
     if (isset($conf['buffering'])) {
         $this->_buffering = $conf['buffering'];
     }
     if (!empty($conf['lineFormat'])) {
         $this->_lineFormat = str_replace(array_keys($this->_formatMap), array_values($this->_formatMap), $conf['lineFormat']);
     }
     if (!empty($conf['timeFormat'])) {
         $this->_timeFormat = $conf['timeFormat'];
     }
     /*
      * If output buffering has been requested, we need to register a
      * shutdown function that will dump the buffer upon termination.
      */
     if ($this->_buffering) {
         register_shutdown_function(array(&$this, '_vmLog_console'));
     }
 }
コード例 #13
0
ファイル: sql.php プロジェクト: BackupTheBerlios/kmit-svn
 /**
  * Constructs a new sql logging object.
  *
  * @param string $name         The target SQL table.
  * @param string $ident        The identification field.
  * @param array $conf          The connection configuration array.
  * @param int $level           Log messages up to and including this level.
  * @access public
  */
 function vmLog_sql($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_table = $name;
     $this->_mask = vmLog::UPTO($level);
     /* If an options array was provided, use it. */
     if (isset($conf['options']) && is_array($conf['options'])) {
         $this->_options = $conf['options'];
     }
     /* If a specific sequence name was provided, use it. */
     if (!empty($conf['sequence'])) {
         $this->_sequence = $conf['sequence'];
     }
     /* If a specific sequence name was provided, use it. */
     if (isset($conf['identLimit'])) {
         $this->_identLimit = $conf['identLimit'];
     }
     /* Now that the ident limit is confirmed, set the ident string. */
     $this->setIdent($ident);
     /* If an existing database connection was provided, use it. */
     if (isset($conf['db'])) {
         $this->_db =& $conf['db'];
         $this->_existingConnection = true;
         $this->_opened = true;
     } else {
         $this->_dsn = $conf['dsn'];
     }
 }
コード例 #14
0
ファイル: LogInit.php プロジェクト: BackupTheBerlios/kmit-svn
/* 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;