/** * 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); }
/** * 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']; } }
/** * 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']; } }
/** * 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')); }
/** * Constructs a new vmLog_mail object. * * Here is how you can customize the mail driver with the conf[] hash : * $conf['from'] : the mail's "From" header line, * $conf['subject'] : the mail's "Subject" line. * * @param string $name The filename of the logfile. * @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_mail($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG) { $this->_id = md5(microtime()); $this->_recipient = $name; $this->_ident = $ident; $this->_mask = vmLog::UPTO($level); if (!empty($conf['from'])) { $this->_from = $conf['from']; } else { $this->_from = ini_get('sendmail_from'); } if (!empty($conf['subject'])) { $this->_subject = $conf['subject']; } if (!empty($conf['preamble'])) { $this->_preamble = $conf['preamble']; } /* register the destructor */ register_shutdown_function(array(&$this, '_vmLog_mail')); }
/** * 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); }
/** * 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')); }
/** * 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']; }
/** * 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')); }
/** * 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')); } }
/** * 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']; } }