/**
* Constructor.
*
* @param array &$options Log object options.
*
* @since 1.7.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;
}
// 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);
}