Path

ez components / documentation / api reference / latest / eventlog


eZ Components latest

EventLog: ezcLogSyslogWriter

[ Tutorial ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Class: ezcLogSyslogWriter

The ezcLogSyslogWriter class provides functionality to write log messages to the UNIX syslog. [source]

Implemented Interfaces

The writer uses the syslog method and works on Windows as well. Please see the documentation of syslog for further information on how to set it up correctly.
The EventLog severity levels are mapped to the syslog error levels. The mapping is as follows:
  • ezcLog::DEBUG: LOG_DEBUG
  • ezcLog::SUCCES_AUDIT: LOG_INFO
  • ezcLog::FAIL_AUDIT: LOG_INFO
  • ezcLog::INFO: LOG_INFO
  • ezcLog::NOTICE: LOG_NOTICE
  • ezcLog::WARNING: LOG_WARNING
  • ezcLog::ERROR: LOG_ERR
  • ezcLog::FATAL: LOG_CRIT

Method Summary

public ezcLogSyslogWriter __construct( $ident, [$option = null], [$facility = LOG_USER] )
Constructs a new syslog writer with the identity $ident, options $option and the facility $facility.
protected string implodeWithKey( $splitEntry, $splitKeyVal, $data )
Returns a string from the hash $data.
public void writeLogMessage( $message, $severity, $source, $category, [$extraInfo = array()], $severity )
Writes the message $message to the log.

Methods

__construct

ezcLogSyslogWriter __construct( string $ident, [int $option = null], [int $facility = LOG_USER] )
Constructs a new syslog writer with the identity $ident, options $option and the facility $facility.
The identity will be prepended to each log message in the syslog.
The $option argument is used to indicate what logging options will be used when generating a log message. See syslog for more information on valid values for $option. The default options are LOG_PID and LOG_ODELAY.
The $facility argument is used to specify what type of program is logging the message. This allows you to specify (in your machine's syslog configuration) how messages coming from different facilities will be handled. See syslog for more information on valid values for $facility.

Parameters

Name Type Description
$ident string  
$option int  
$facility int  

implodeWithKey

string implodeWithKey( string $splitEntry, string $splitKeyVal, array(mixed=>mixed) $data )
Returns a string from the hash $data.
The string $splitEntry specifies the string that will be inserted between the pairs. The string $splitKeyVal specifies the string that will be inserted in each pair.
Example:
1.  $this->implodeWithKey", "": "array"Car" => "red""Curtains" => "blue" );
Will create the following string:
 Car: red, Curtains: blue

Parameters

Name Type Description
$splitEntry string  
$splitKeyVal string  
$data array(mixed=>mixed)  

writeLogMessage

void writeLogMessage( string $message, $severity, string $source, string $category, [array(string=>string) $extraInfo = array()], int $severity )
Writes the message $message to the log.
The writer can use the severity, source, and category to filter the incoming messages and determine the location where the messages should be written.
The array $optional contains extra information that can be added to the log. For example: line numbers, file names, usernames, etc.

Parameters

Name Type Description
$message string  
$severity int ezcLog::DEBUG, ezcLog::SUCCESS_AUDIT, ezcLog::FAILED_AUDIT, ezcLog::INFO, ezcLog::NOTICE, ezcLog::WARNING, ezcLog::ERROR or ezcLog::FATAL.
$source string  
$category string  
$extraInfo array(string=>string)  
$severity  

Throws

ClassDescription
ezcLogWriterException If the log writer was unable to write the log message

Last updated: Mon, 10 Nov 2008