/** * 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->db = JFactory::getDbo(); $this->driver = null; $this->host = null; $this->user = null; $this->password = null; $this->database = null; $this->prefix = null; } else { $this->db = null; $this->driver = empty($this->options['db_driver']) ? 'mysqli' : $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. * * @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. * * @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.2 * @throws RuntimeException */ public function __construct(array &$options) { // Call the parent constructor. parent::__construct($options); // Throw an exception if there is not a valid callback if (!isset($this->options['callback']) || !is_callable($this->options['callback'])) { throw new RuntimeException('JLogLoggerCallback created without valid callback function.'); } $this->callback = $this->options['callback']; }
/** * Constructor. * * @param array &$options Log object options. * * @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; } // Default logging facility is LOG_USER for Windows compatibility. $sysFacility = LOG_USER; // If we have a facility passed in and we're not on Windows, reset it. if (isset($this->options['sys_facility']) && !IS_WIN) { $sysFacility = $this->options['sys_facility']; } // Open the Syslog connection. openlog((string) $this->options['sys_ident'], $sysOptions, $sysFacility); }
/** * Constructor. * * @param array &$options Log object options. * * @since 12.2 */ public function __construct(array &$options) { // Call the parent constructor. parent::__construct($options); // Throw an exception if there is not a valid callback if (isset($this->options['callback']) && is_callable($this->options['callback'])) { $this->callback = $this->options['callback']; } else { throw new JLogException(JText::_('JLogLoggerCallback created without valid callback function.')); } }
/** * Constructor. * * @param array &$options Log object options. * * @since 11.1 * @deprecated 13.3 */ public function __construct(array &$options) { JLog::add('JLogger is deprecated. Use JLogLogger instead.', JLog::WARNING, 'deprecated'); parent::__construct($options); }