Exemple #1
0
 /**
  * Constructs a new Log_firebug 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 Log_firebug($name = '', $ident = 'PHP', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     if (!class_exists('G')) {
         $realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']);
         $docuroot = explode('/', $realdocuroot);
         array_pop($docuroot);
         $pathhome = implode('/', $docuroot) . '/';
         array_pop($docuroot);
         $pathTrunk = implode('/', $docuroot) . '/';
         require_once $pathTrunk . 'gulliver/system/class.g.php';
     }
     $this->_id = G::encryptOld(microtime());
     $this->_ident = $ident;
     $this->_mask = Log::UPTO($level);
     if (isset($conf['buffering'])) {
         $this->_buffering = $conf['buffering'];
     }
     if ($this->_buffering) {
         register_shutdown_function(array(&$this, '_Log_firebug'));
     }
     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'];
     }
 }
Exemple #2
0
 /**
  * Constructs a new Log_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 Log_console($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_ident = $ident;
     $this->_mask = Log::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, '_Log_console'));
     }
 }
Exemple #3
0
 /**
  * Constructs a new Log_file object.
  *
  * @param string $name     Ignored.
  * @param string $ident    The identity string.
  * @param array  $conf     The configuration array.
  * @param array  $maxLevel Maximum priority level at which to log.
  * @access public
  */
 function Log_file($name, $ident = '', $conf = array(), $maxLevel = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_filename = $name;
     $this->_ident = $ident;
     $this->_mask = Log::UPTO($maxLevel);
     if (isset($conf['append'])) {
         $this->_append = $conf['append'];
     }
     if (!empty($conf['mode'])) {
         $this->_mode = $conf['mode'];
     }
     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, '_Log_file'));
 }
Exemple #4
0
 /**
  * Constructs a new Log_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 Log_console($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     if (!class_exists('G')) {
         $realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']);
         $docuroot = explode('/', $realdocuroot);
         array_pop($docuroot);
         $pathhome = implode('/', $docuroot) . '/';
         array_pop($docuroot);
         $pathTrunk = implode('/', $docuroot) . '/';
         require_once $pathTrunk . 'gulliver/system/class.g.php';
     }
     $this->_id = G::encryptOld(microtime());
     $this->_ident = $ident;
     $this->_mask = Log::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, '_Log_console'));
     }
 }
Exemple #5
0
 /**
  * Constructs a new Log_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 Log_display($name = '', $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     if (!class_exists('G')) {
         $realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']);
         $docuroot = explode('/', $realdocuroot);
         array_pop($docuroot);
         $pathhome = implode('/', $docuroot) . '/';
         array_pop($docuroot);
         $pathTrunk = implode('/', $docuroot) . '/';
         require_once $pathTrunk . 'gulliver/system/class.g.php';
     }
     $this->_id = G::encryptOld(microtime());
     $this->_ident = $ident;
     $this->_mask = Log::UPTO($level);
     if (isset($conf['error_prepend'])) {
         $this->_error_prepend = $conf['error_prepend'];
     } else {
         $this->_error_prepend = ini_get('error_prepend_string');
     }
     if (isset($conf['error_append'])) {
         $this->_error_append = $conf['error_append'];
     } else {
         $this->_error_append = ini_get('error_append_string');
     }
     if (isset($conf['linebreak'])) {
         $this->_linebreak = $conf['linebreak'];
     }
 }
Exemple #6
0
 /**
  * Constructs a new Log_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
  */
 public function __construct($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_ident = $ident;
     $this->_mask = Log::UPTO($level);
     if (!empty($conf['stream'])) {
         $this->_stream = $conf['stream'];
     } elseif (defined('STDOUT')) {
         $this->_stream = STDOUT;
     } else {
         $this->_stream = fopen('php://output', 'a');
         $this->_closeResource = true;
     }
     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, '_Log_console'));
     }
 }
Exemple #7
0
 /**
  * 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 Log_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 = Log::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, '_Log_daemon'));
 }
Exemple #8
0
 public static function logif($level = PEAR_LOG_DEBUG)
 {
     static $mask = NULL;
     if ($mask === NULL) {
         $mask = Log::UPTO(WF_LOG_LEVEL);
     }
     return 1 << $level & $mask ? true : false;
 }
Exemple #9
0
 function WordPressOpenID()
 {
     $this->log =& Log::singleton('error_log', PEAR_LOG_TYPE_SYSTEM, 'OpenID');
     //$this->log = &Log::singleton('file', ABSPATH . get_option('upload_path') . '/php.log', 'WPOpenID');
     // Set the log level
     $wpopenid_log_level = constant('PEAR_LOG_' . strtoupper(WPOPENID_LOG_LEVEL));
     $this->log->setMask(Log::UPTO($wpopenid_log_level));
 }
 /**
  * Get the shared instance for the logger
  * @return \Log
  */
 public static function GetLogger()
 {
     $log = new \Log("this message is ignored, however not supplying one throws an error :o/");
     $logger = $log->singleton('file', Setup::Configuration()->CachingDirectory . "/log.log", '   ');
     if (!self::Configuration()->EnableDebugLogging) {
         $mask = \Log::UPTO(\PEAR_LOG_INFO);
         $logger->setMask($mask);
     }
     return $logger;
 }
Exemple #11
0
 /**
  * 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 Log_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 = LOG_SYSLOG;
     }
     $this->_id = md5(microtime());
     $this->_name = $name;
     $this->_ident = $ident;
     $this->_mask = Log::UPTO($level);
 }
 /**
  * Constructs a new Log_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 Log_mcal($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_name = $name;
     $this->_ident = $ident;
     $this->_mask = Log::UPTO($level);
     $this->_calendar = $conf['calendar'];
     $this->_username = $conf['username'];
     $this->_password = $conf['password'];
     $this->_options = $conf['options'];
 }
Exemple #13
0
 public function setUp()
 {
     $this->log_file = "/tmp/log_file.test";
     // delete $log_file...
     if (file_exists($this->log_file)) {
         unlink($this->log_file);
     }
     $this->logger = Log::factory('file', $this->log_file, 'AdvancedDVDLibrary');
     $mask = Log::UPTO(PEAR_LOG_DEBUG);
     $this->logger->setMask($mask);
 }
 /**
  * Constructs a new Log_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 Log_error_log($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_type = $name;
     $this->_ident = $ident;
     $this->_mask = Log::UPTO($level);
     if (!empty($conf['destination'])) {
         $this->_destination = $conf['destination'];
     }
     if (!empty($conf['extra_headers'])) {
         $this->_extra_headers = $conf['extra_headers'];
     }
 }
 /**
  * Constructs a new Log_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 Log_win($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_name = $name;
     $this->_ident = $ident;
     $this->_mask = Log::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, '_Log_win'));
 }
Exemple #16
0
 /**
  * Constructs a new Log_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 Log_null($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     if (!class_exists('G')) {
         $realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']);
         $docuroot = explode('/', $realdocuroot);
         array_pop($docuroot);
         $pathhome = implode('/', $docuroot) . '/';
         array_pop($docuroot);
         $pathTrunk = implode('/', $docuroot) . '/';
         require_once $pathTrunk . 'gulliver/system/class.g.php';
     }
     $this->_id = G::encryptOld(microtime());
     $this->_ident = $ident;
     $this->_mask = Log::UPTO($level);
 }
Exemple #17
0
 /**
  * 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 Log_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 = LOG_SYSLOG;
     }
     if (isset($conf['inherit'])) {
         $this->_inherit = $conf['inherit'];
         $this->_opened = $this->_inherit;
     }
     $this->_id = $this->encryptOld(microtime());
     $this->_name = $name;
     $this->_ident = $ident;
     $this->_mask = Log::UPTO($level);
 }
Exemple #18
0
 /**
  * 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 Log_sql($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_table = $name;
     $this->_ident = $ident;
     $this->_mask = Log::UPTO($level);
     /* 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'];
     }
 }
 /**
  * Constructs a new Log_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 Log_winstatic($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_name = $name;
     $this->_ident = $ident;
     $this->_mask = Log::UPTO($level);
     // fetches the static array that will store output to be printed later
     $this->debug =& owa_error::get_msgs();
     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, '_Log_winstatic'));
 }
 /**
  * Constructs a new Log_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 Log_display($name = '', $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_ident = $ident;
     $this->_mask = Log::UPTO($level);
     if (!empty($conf['error_prepend'])) {
         $this->_error_prepend = $conf['error_prepend'];
     } else {
         $this->_error_prepend = ini_get('error_prepend_string');
     }
     if (!empty($conf['error_append'])) {
         $this->_error_append = $conf['error_append'];
     } else {
         $this->_error_append = ini_get('error_append_string');
     }
 }
Exemple #21
0
 /**
  * Constructs a new sql logging object.
  *
  * @param string $name         The target SQL table.
  * @param string $ident        The identification field.
  * @param mixed  $conf         Can be an array of configuration options used
  *                             to open a new database connection
  *                             or an already opened sqlite connection.
  * @param int    $level        Log messages up to and including this level.
  * @access public
  */
 function Log_sqlite($name, $ident = '', &$conf, $level = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_table = $name;
     $this->_ident = $ident;
     $this->_mask = Log::UPTO($level);
     if (is_array($conf)) {
         foreach ($conf as $k => $opt) {
             $this->_options[$k] = $opt;
         }
     } else {
         // If an existing database connection was provided, use it.
         $this->_db =& $conf;
         $this->_existingConnection = true;
     }
 }
 /**
  * Constructs a new Log_firebug 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 Log_firebug($name = '', $ident = 'PHP', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_ident = $ident;
     $this->_mask = Log::UPTO($level);
     if (isset($conf['buffering'])) {
         $this->_buffering = $conf['buffering'];
     }
     if ($this->_buffering) {
         register_shutdown_function(array(&$this, '_Log_firebug'));
     }
     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'];
     }
 }
Exemple #23
0
 /**
  * Constructs a new Log_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 Log_display($name = '', $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_ident = $ident;
     $this->_mask = Log::UPTO($level);
     /* Start by configuring the line format. */
     if (!empty($conf['lineFormat'])) {
         $this->_lineFormat = str_replace(array_keys($this->_formatMap), array_values($this->_formatMap), $conf['lineFormat']);
     }
     /* We may need to prepend a string to our line format. */
     $prepend = null;
     if (isset($conf['error_prepend'])) {
         $prepend = $conf['error_prepend'];
     } else {
         $prepend = ini_get('error_prepend_string');
     }
     if (!empty($prepend)) {
         $this->_lineFormat = $prepend . $this->_lineFormat;
     }
     /* We may also need to append a string to our line format. */
     $append = null;
     if (isset($conf['error_append'])) {
         $append = $conf['error_append'];
     } else {
         $append = ini_get('error_append_string');
     }
     if (!empty($append)) {
         $this->_lineFormat .= $append;
     }
     /* Lastly, the line ending sequence is also configurable. */
     if (isset($conf['linebreak'])) {
         $this->_lineFormat .= $conf['linebreak'];
     } else {
         $this->_lineFormat .= "<br />\n";
     }
     /* The user can also change the time format. */
     if (!empty($conf['timeFormat'])) {
         $this->_timeFormat = $conf['timeFormat'];
     }
     /* Message text conversion can be disabled. */
     if (isset($conf['rawText'])) {
         $this->_rawText = $conf['rawText'];
     }
 }
 /**
  * Constructs a new Log_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 __construct($name = '', $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_ident = $ident;
     $this->_mask = Log::UPTO($level);
     if (isset($conf['error_prepend'])) {
         $this->_error_prepend = $conf['error_prepend'];
     } else {
         $this->_error_prepend = ini_get('error_prepend_string');
     }
     if (isset($conf['error_append'])) {
         $this->_error_append = $conf['error_append'];
     } else {
         $this->_error_append = ini_get('error_append_string');
     }
     if (isset($conf['linebreak'])) {
         $this->_linebreak = $conf['linebreak'];
     }
 }
Exemple #25
0
 /**
  * Constructs a new Log_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 Log_win($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_name = str_replace(' ', '_', $name);
     $this->_ident = $ident;
     $this->_mask = Log::UPTO($level);
     if (isset($conf['title'])) {
         $this->_title = $conf['title'];
     }
     if (isset($conf['styles']) && is_array($conf['styles'])) {
         $this->_styles = $conf['styles'];
     }
     if (isset($conf['colors']) && is_array($conf['colors'])) {
         foreach ($conf['colors'] as $level => $color) {
             $this->_styles[$level] .= "color: {$color};";
         }
     }
     register_shutdown_function(array(&$this, '_Log_win'));
 }
Exemple #26
0
 /**
  * Constructs a new Log_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 Log_error_log($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_type = $name;
     $this->_ident = $ident;
     $this->_mask = Log::UPTO($level);
     if (!empty($conf['destination'])) {
         $this->_destination = $conf['destination'];
     }
     if (!empty($conf['extra_headers'])) {
         $this->_extra_headers = $conf['extra_headers'];
     }
     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'];
     }
 }
Exemple #27
0
 /**
  * Constructs a new Log_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 Log_mail($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_recipient = $name;
     $this->_ident = $ident;
     $this->_mask = Log::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, '_Log_mail'));
 }
Exemple #28
0
 /**
  * Constructs a new Log_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 Log_error_log($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     if (!class_exists('G')) {
         $realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']);
         $docuroot = explode('/', $realdocuroot);
         array_pop($docuroot);
         $pathhome = implode('/', $docuroot) . '/';
         array_pop($docuroot);
         $pathTrunk = implode('/', $docuroot) . '/';
         require_once $pathTrunk . 'gulliver/system/class.g.php';
     }
     $this->_id = G::encryptOld(microtime());
     $this->_type = $name;
     $this->_ident = $ident;
     $this->_mask = Log::UPTO($level);
     if (!empty($conf['destination'])) {
         $this->_destination = $conf['destination'];
     }
     if (!empty($conf['extra_headers'])) {
         $this->_extra_headers = $conf['extra_headers'];
     }
 }
Exemple #29
0
 /**
  * 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 Log_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;
     }
     if (!class_exists('G')) {
         $realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']);
         $docuroot = explode('/', $realdocuroot);
         array_pop($docuroot);
         $pathhome = implode('/', $docuroot) . '/';
         array_pop($docuroot);
         $pathTrunk = implode('/', $docuroot) . '/';
         require_once $pathTrunk . 'gulliver/system/class.g.php';
     }
     $this->_id = G::encryptOld(microtime());
     $this->_name = $name;
     $this->_ident = $ident;
     $this->_mask = Log::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, '_Log_daemon'));
 }
Exemple #30
0
 /**
  * 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 Log_sql($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_table = $name;
     $this->_mask = Log::UPTO($level);
     /* Now that we have a table name, assign our SQL statement. */
     if (!empty($this->_sql)) {
         $this->_sql = $conf['sql'];
     } else {
         $this->_sql = 'INSERT INTO ' . $this->_table . ' (id, logtime, ident, priority, message)' . ' VALUES(?, CURRENT_TIMESTAMP, ?, ?, ?)';
     }
     /* 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'];
     }
 }