Created
June 4, 2013 20:01
-
-
Save AV4TAr/5709067 to your computer and use it in GitHub Desktop.
Loguear todos los eventos de ZF2 al error_log
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Module { | |
//... | |
public function onBootstrap(EventInterface $e) | |
{ | |
//... | |
$eventManager = $e->getApplication()->getEventManager(); | |
$sharedEventManager = $eventManager->getSharedManager(); | |
$sharedEventManager->attach('*', | |
'*', | |
function ($e) | |
{ | |
$event = $e->getName(); | |
$target = get_class($e->getTarget()); | |
$params = $e->getParams(); | |
$output = sprintf( | |
'Event "%s" was triggered on target "%s", with parameters %s', | |
$event, | |
$target, | |
json_encode($params)); | |
error_log($output); | |
// Return true so this listener doesn't break the validator | |
// chain triggering session.validate listeners | |
return true; | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment