/** * Constructor. * * @param array &$options Log object options. * * @return void * * @since 11.1 */ 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'] = JFactory::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(); }
/** * Constructor. * * @param array $options Log object options. * * @return void * * @since 11.1 */ 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); }
/** * Constructor. * * @param array &$options Log object options. * * @since 12.1 */ public function __construct(array &$options) { parent::__construct($options); if (!empty($this->options['line_separator'])) { $this->line_separator = $this->options['line_separator']; } }
/** * Constructor. * * @param array &$options Log object options. * * @since 11.1 */ 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_driver'])) { $this->dbo = JFactory::getDBO(); $this->driver = null; $this->host = null; $this->user = null; $this->password = null; $this->database = null; $this->prefix = null; } else { $this->dbo = null; $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']; }
/** * Constructor. * * @param array &$options Log object options. * * @return void * * @since 11.1 * @throws LogException */ 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 = JFactory::getDBO(); $this->driver = JFactory::getConfig()->get('dbtype'); $this->host = JFactory::getConfig()->get('host'); $this->user = JFactory::getConfig()->get('user'); $this->password = JFactory::getConfig()->get('password'); $this->database = JFactory::getConfig()->get('db'); $this->prefix = JFactory::getConfig()->get('dbprefix'); } // We need to get the database connection settings from the configuration options. 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']; }