Versions
Look up a class, method, property or event

CSysLogRoute

Package system.logging
Inheritance class CSysLogRoute » CLogRoute » CComponent
Since 1.1.16
Source Code framework/logging/CSysLogRoute.php
CSysLogRoute dumps log messages to syslog.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
categories mixed array of categories, or string list separated by comma or space. CLogRoute
enabled boolean whether to enable this log route. CLogRoute
except mixed array of categories, or string list separated by comma or space, to EXCLUDE from logs. CLogRoute
facility integer syslog facility name. CSysLogRoute
filter mixed the additional filter (eg CLogFilter) that can be applied to the log messages. CLogRoute
identity string syslog identity name. CSysLogRoute
levels string list of levels separated by comma or space. CLogRoute
logs array the logs that are collected so far by this log route. CLogRoute

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__call() Calls the named method which is not a class method. CComponent
__get() Returns a property value, an event handler list or a behavior based on its name. CComponent
__isset() Checks if a property value is null. CComponent
__set() Sets value of a component property. CComponent
__unset() Sets a component property to be null. CComponent
asa() Returns the named behavior object. CComponent
attachBehavior() Attaches a behavior to this component. CComponent
attachBehaviors() Attaches a list of behaviors to the component. CComponent
attachEventHandler() Attaches an event handler to an event. CComponent
canGetProperty() Determines whether a property can be read. CComponent
canSetProperty() Determines whether a property can be set. CComponent
collectLogs() Retrieves filtered log messages from logger for further processing. CLogRoute
detachBehavior() Detaches a behavior from the component. CComponent
detachBehaviors() Detaches all behaviors from the component. CComponent
detachEventHandler() Detaches an existing event handler. CComponent
disableBehavior() Disables an attached behavior. CComponent
disableBehaviors() Disables all behaviors attached to this component. CComponent
enableBehavior() Enables an attached behavior. CComponent
enableBehaviors() Enables all behaviors attached to this component. CComponent
evaluateExpression() Evaluates a PHP expression or callback under the context of this component. CComponent
getEventHandlers() Returns the list of attached event handlers for an event. CComponent
hasEvent() Determines whether an event is defined. CComponent
hasEventHandler() Checks whether the named event has attached handlers. CComponent
hasProperty() Determines whether a property is defined. CComponent
init() Initializes the route. CLogRoute
raiseEvent() Raises an event. CComponent

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
formatLogMessage() Formats a log message given different fields. CLogRoute
processLogs() Sends log messages to syslog. CSysLogRoute

Property Details

facility property
public integer $facility;

syslog facility name.

identity property
public string $identity;

syslog identity name.

Method Details

processLogs() method
protected void processLogs(array $logs)
$logs array list of log messages.
Source Code: framework/logging/CSysLogRoute.php#35 (show)
protected function processLogs($logs)
{
    static 
$syslogLevels=array(
        
CLogger::LEVEL_TRACE=>LOG_DEBUG,
        
CLogger::LEVEL_WARNING=>LOG_WARNING,
        
CLogger::LEVEL_ERROR=>LOG_ERR,
        
CLogger::LEVEL_INFO=>LOG_INFO,
        
CLogger::LEVEL_PROFILE=>LOG_DEBUG,
    );

    
openlog($this->identity,LOG_ODELAY|LOG_PID,$this->facility);
    foreach(
$logs as $log)
        
syslog($syslogLevels[$log[1]],$this->formatLogMessage(str_replace("\n",', ',$log[0]),$log[1],$log[2],$log[3]));
    
closelog();
}

Sends log messages to syslog.

Be the first person to leave a comment

Please to leave your comment.