* @copyright 2005 by http://wombat.exit0.net * @package wombatSite * @subpackage event */ wbFactory::includeClass( 'wbLog' ); /** * event * * * @version 0.1.0 * @package wombatSite * @subpackage event */ class wbEventHandler_Log extends wbEventHandler { /** * handler default parameter * @var array $_params */ var $_paramsDefault = array( 'logid' => 'event', 'priority' => 'info' ); /** * logger id * @var string $_loggerId */ var $_logId; /** * handle event * * @access public * @param object $e event object * @return string $msg */ function process( &$e ) { $this->_logId = $this->_params['logid']; $this->_logPrio = $this->_params['priority']; $data = array( $e->getId(), $e->getMsg() ); $eData = $e->getData(); foreach( $eData as $key => $value ) { if( is_string( $value ) || is_numeric( $value ) ) { array_push( $data, $key . ': ' . $value ); } } $function = $this->_logPrio; if( !is_callable( array( 'wbLog', $function ) ) ) { $function = 'log'; } wbLog::$function( $this->_logId, $data ); return true; } } ?>