Source for file syslog.php
Documentation is available at syslog.php
* @package Joomla.Platform
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* Joomla! Syslog Log class
* This class is designed to call the PHP Syslog function call which is then sent to the
* system wide log system. For Linux/Unix based systems this is the syslog subsystem, for
* the Windows based implementations this can be found in the Event Log. For Windows,
* permissions may prevent PHP from properly outputting messages.
* @package Joomla.Platform
* @var array Translation array for JLogEntry priorities to SysLog priority names.
JLog::EMERGENCY =>
'EMERG',
JLog::CRITICAL =>
'CRIT',
JLog::WARNING =>
'WARNING',
JLog::NOTICE =>
'NOTICE',
* @param array &$options Log object 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'] =
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'];
$this->options['sys_use_stderr'] =
false;
// Build the Syslog options from our log object options.
$sysOptions =
$sysOptions |
LOG_PID;
if ($this->options['sys_use_stderr'])
$sysOptions =
$sysOptions |
LOG_PERROR;
// Default logging facility is LOG_USER for Windows compatibility.
// If we have a facility passed in and we're not on Windows, reset it.
$sysFacility =
$this->options['sys_facility'];
// Open the Syslog connection.
openlog((string)
$this->options['sys_ident'], $sysOptions, $sysFacility);
* Method to add an entry to the log.
* @param JLogEntry $entry The log entry object to add to the log.
public function addEntry(JLogEntry $entry)
// Generate the value for the priority based on predefined constants.
// Send the entry to Syslog.
syslog($priority, '[' .
$entry->category .
'] ' .
$entry->message);
Documentation generated on Tue, 19 Nov 2013 15:14:46 +0100 by phpDocumentor 1.4.3