string) $extraInfo */ public function writeLogMessage( $message, $severity, $source, $category, $extraInfo = array() ) { // generate the log message $extra = ""; if ( sizeof( $extraInfo ) > 0 ) { $extra = " (" . $this->implodeWithKey( ", ", ": ", $extraInfo ) . ")"; } $logMsg = "[".ezcLog::translateSeverityName( $severity ) . "] ". ( $source == "" ? "" : "[$source] ") . ( $category == "" ? "" : "[$category] " ). "{$message}{$extra}"; // Map severity to syslog severity $syslogSeverity = LOG_INFO; switch ( $severity ) { case ezcLog::DEBUG: $syslogSeverity = LOG_DEBUG; break; case ezcLog::SUCCESS_AUDIT: case ezcLog::FAILED_AUDIT: case ezcLog::INFO: $syslogSeverity = LOG_INFO; break; case ezcLog::NOTICE: $syslogSeverity = LOG_NOTICE; break; case ezcLog::WARNING: $syslogSeverity = LOG_WARNING; break; case ezcLog::ERROR: $syslogSeverity = LOG_ERR; break; case ezcLog::FATAL: $syslogSeverity = LOG_CRIT; break; default: $syslogSeverity = LOG_INFO; break; } // write to syslog $success = syslog( $syslogSeverity, $logMsg ); if ( !$success ) { throw new ezcLogWriterException( new Exception( "Couldn't not write to syslog" ) ); } } /** * 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: * * $this->implodeWithKey( ", ", ": ", array( "Car" => "red", "Curtains" => "blue" ); * * * Will create the following string: *
     * Car: red, Curtains: blue
     * 
* * @param string $splitEntry * @param string $splitKeyVal * @param array(mixed=>mixed) $data * @return string */ protected function implodeWithKey( $splitEntry, $splitKeyVal, $data) { $total = ""; if ( is_array( $data ) ) { foreach ( $data as $key => $val ) { $total .= $splitEntry . $key . $splitKeyVal . $val; } } return substr( $total, strlen( $splitEntry ) ); } } ?>