Beispiel #1
0
 public function __construct(array &$options)
 {
     // Call the parent constructor.
     parent::__construct($options);
     // Ensure that we have an identity string for the SysLog entries.
     if (empty($this->options['sys_ident'])) {
         $this->options['sys_ident'] = 'Joomla Platform';
     }
     // If the option to add the process id to SysLog entries is set use it, otherwise default to true.
     if (isset($this->options['sys_add_pid'])) {
         $this->options['sys_add_pid'] = (bool) $this->options['sys_add_pid'];
     } else {
         $this->options['sys_add_pid'] = true;
     }
     // If the option to also send SysLog entries to STDERR is set use it, otherwise default to false.
     if (isset($this->options['sys_use_stderr'])) {
         $this->options['sys_use_stderr'] = (bool) $this->options['sys_use_stderr'];
     } else {
         $this->options['sys_use_stderr'] = false;
     }
     // Build the SysLog options from our log object options.
     $sysOptions = 0;
     if ($this->options['sys_add_pid']) {
         $sysOptions = $sysOptions | LOG_PID;
     }
     if ($this->options['sys_use_stderr']) {
         $sysOptions = $sysOptions | LOG_PERROR;
     }
     // Open the SysLog connection.
     openlog((string) $this->options['sys_ident'], $sysOptions, LOG_USER);
 }
Beispiel #2
0
 public function __construct(array &$options)
 {
     // Call the parent constructor.
     parent::__construct($options);
     // The name of the text file defaults to 'error.php' if not explicitly given.
     if (empty($this->options['text_file'])) {
         $this->options['text_file'] = 'error.php';
     }
     // The name of the text file path defaults to that which is set in configuration if not explicitly given.
     if (empty($this->options['text_file_path'])) {
         $this->options['text_file_path'] = MFactory::getConfig()->get('log_path');
     }
     // False to treat the log file as a php file.
     if (empty($this->options['text_file_no_php'])) {
         $this->options['text_file_no_php'] = false;
     }
     // Build the full path to the log file.
     $this->path = $this->options['text_file_path'] . '/' . $this->options['text_file'];
     // Use the default entry format unless explicitly set otherwise.
     if (!empty($this->options['text_entry_format'])) {
         $this->format = (string) $this->options['text_entry_format'];
     }
     // Build the fields array based on the format string.
     $this->parseFields();
 }
Beispiel #3
0
 public function __construct(array &$options)
 {
     // Call the parent constructor.
     parent::__construct($options);
     // If both the database object and driver options are empty we want to use the system database connection.
     if (empty($this->options['db_object']) && empty($this->options['db_driver'])) {
         $this->dbo = MFactory::getDBO();
         $this->driver = MFactory::getConfig()->get('dbtype');
         $this->host = MFactory::getConfig()->get('host');
         $this->user = MFactory::getConfig()->get('user');
         $this->password = MFactory::getConfig()->get('password');
         $this->database = MFactory::getConfig()->get('db');
         $this->prefix = MFactory::getConfig()->get('dbprefix');
     } else {
         $this->driver = empty($this->options['db_driver']) ? 'mysql' : $this->options['db_driver'];
         $this->host = empty($this->options['db_host']) ? '127.0.0.1' : $this->options['db_host'];
         $this->user = empty($this->options['db_user']) ? 'root' : $this->options['db_user'];
         $this->password = empty($this->options['db_pass']) ? '' : $this->options['db_pass'];
         $this->database = empty($this->options['db_database']) ? 'logging' : $this->options['db_database'];
         $this->prefix = empty($this->options['db_prefix']) ? 'jos_' : $this->options['db_prefix'];
     }
     // The table name is independent of how we arrived at the connection object.
     $this->table = empty($this->options['db_table']) ? '#__log_entries' : $this->options['db_table'];
 }