getmapper()->appendRule( new ezcLogFilterRule( new ezcLogFilter, $writer, true ) ); // ... $username = "John Doe"; $service = "Paynet Terminal"; // ... // Add automatically the username to the log message, when the log message is either a SUCCESS_AUDIT or a FAILED_AUDIT. $log->setSeverityAttributes( ezcLog::SUCCESS_AUDIT | ezcLog::FAILED_AUDIT, array( "username" => $username ) ); // Same can be done with the source of the log message. $log->setSourceAttributes( array( "Payment" ), array( "service" => $service ) ); // Writing some log messages. $log->log( "Authentication failed", ezcLog::FAILED_AUDIT, array( "source" => "security", "category" => "login/logoff" ) ); $log->source = "Payment"; $log->log( "Connecting with the server.", ezcLog::DEBUG, array( "category" => "external connections" ) ); $log->log( "Paid with credit card.", ezcLog::SUCCESS_AUDIT, array( "category" => "shop" ) ); ?>