Plop
A simple logging library for PHP
|
An handler that sends log messages to the system logs (syslog). More...
Public Member Functions | |
__construct ($address=self::DEFAULT_ADDRESS, $facility=LOG_USER) | |
__destruct () | |
Free the resources used by this handler. | |
Public Member Functions inherited from Plop\HandlerAbstract | |
__construct (\Plop\FormatterInterface $formatter=null,\Plop\FiltersCollectionAbstract $filters=null) | |
getFilters () | |
getFormatter () | |
handle (\Plop\RecordInterface $record) | |
handleError (\Plop\RecordInterface $record,\Exception $exception) | |
setFilters (\Plop\FiltersCollectionAbstract $filters) | |
setFormatter (\Plop\FormatterInterface $formatter) | |
Public Attributes | |
const | DEFAULT_ADDRESS = 'udg:///dev/log' |
Default address for the system logs. | |
const | LOG_FORMAT_STRING = "<%d>%s\000" |
Specific format string used for system logs. | |
Protected Member Functions | |
close () | |
emit (\Plop\RecordInterface $record) | |
encodePriority ($facility, $priority) | |
makeSocket () | |
mapPriority ($levelName) | |
Protected Member Functions inherited from Plop\HandlerAbstract | |
emit (\Plop\RecordInterface $record) | |
format (\Plop\RecordInterface $record) | |
getStderr () | |
Protected Attributes | |
$address | |
Address of the syslog where the logs will be sent. | |
$facility | |
The facility to use when logging the messages. | |
$socket | |
The socket that will be used to send the logs. | |
Protected Attributes inherited from Plop\HandlerAbstract | |
$filters | |
An object handling a collection of filters. | |
$formatter | |
Formatter object to use for this handler. | |
Static Protected Attributes | |
static | $facilityNames |
Mapping between the facility names and their associated constant. More... | |
static | $priorityMap |
static | $priorityNames |
Mapping between Plop's log levels and the syslog ones. More... | |
An handler that sends log messages to the system logs (syslog).
Definition at line 28 of file SysLog.php.
Plop\Handler\SysLog::__construct | ( | $address = self::DEFAULT_ADDRESS , |
|
$facility = LOG_USER |
|||
) |
Construct a new instance of this handler.
string | $address | (optional) Address of the syslog daemon where the log messages will be sent, in the form "protocol://address:port". The default is to use the value of the Plop::Handler::SysLog::DEFAULT_ADDRESS constant, which sends logs to the local syslog daemon. IPv6 addresses must be enclosed in square brackets, eg. "tls://[fe80::1]:6514/". |
int | string | $facility | (optional) The name or the value of the facility to use when sending the logs. By default, the "user" facility is used. |
Definition at line 115 of file SysLog.php.
References Plop\Handler\SysLog\$address, Plop\Handler\SysLog\$facility, and Plop\Handler\SysLog\makeSocket().
|
protected |
Close the socket associated with this handler.
Definition at line 191 of file SysLog.php.
Referenced by Plop\Handler\SysLog\__destruct().
|
protected |
Definition at line 219 of file SysLog.php.
References Plop\Handler\SysLog\encodePriority(), Plop\HandlerAbstract\format(), Plop\HandlerAbstract\handleError(), and Plop\Handler\SysLog\mapPriority().
|
protected |
Encode facility & priority information.
int | string | $facility | The facility. |
int | string | $priority | The priority. |
int | The facility & priority, combined in a single integer. |
Definition at line 174 of file SysLog.php.
References Plop\Handler\SysLog\$facility.
Referenced by Plop\Handler\SysLog\emit().
|
protected |
Create the socket used to communicate with the syslog.
resource | The newly-created socket. |
Definition at line 156 of file SysLog.php.
Referenced by Plop\Handler\SysLog\__construct().
|
protected |
Return the syslog priority associated with the given (Plop) level name.
string | $levelName | The name of a log level defined in Plop. |
string | The syslog level to use to match the one given. |
Definition at line 210 of file SysLog.php.
Referenced by Plop\Handler\SysLog\emit().
|
staticprotected |
Mapping between the facility names and their associated constant.
Definition at line 53 of file SysLog.php.
|
staticprotected |
From python's logging/handlers.py : This map appears to be trivially lowercasing the key. However, there's more to it than meets the eye - in some locales, lowercasing gives unexpected results. See SF #1524081: in the Turkish locale,
"INFO".lower() != "info"
The same is true for PHP.
Definition at line 76 of file SysLog.php.
|
staticprotected |
Mapping between Plop's log levels and the syslog ones.
Definition at line 37 of file SysLog.php.