CSysLogRoute
包 | system.logging |
---|---|
继承 | class CSysLogRoute » CLogRoute » CComponent |
可用自 | 1.1.16 |
源码 | framework/logging/CSysLogRoute.php |
CSysLogRoute dumps log messages to syslog.
公共属性
属性 | 类型 | 描述 | 被定义在 |
---|---|---|---|
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 |
公共方法
方法 | 描述 | 被定义在 |
---|---|---|
__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 |
受保护的方法
方法 | 描述 | 被定义在 |
---|---|---|
formatLogMessage() | Formats a log message given different fields. | CLogRoute |
processLogs() | Sends log messages to syslog. | CSysLogRoute |
属性详情
facility
属性
public integer $facility;
syslog facility name.
identity
属性
public string $identity;
syslog identity name.
方法详情
processLogs()
方法
protected void processLogs(array $logs)
| ||
$logs | array | list of log messages. |
源码: framework/logging/CSysLogRoute.php#35 (显示)
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.