<?php
class SyslogFilter extends CFilter
{
  protected function preFilter($filterChain)
  {
   // if (Yii::app()->params['environment'] == 'PRODUCTION') {
      $logger = Logger::getLogger('eventserver-gui');
      $logger->info("ACTION START - USER:".Yii::app()->user->name." ACTION:".$filterChain->controller->id ."->".$filterChain->action->id." PARAMS:".print_r($filterChain->controller->actionParamsforLog, true));
    //}
    // logica applicata prima che l'action venga eseguita
    return true; // false se l'action non deve essere eseguita
  }

  protected function postFilter($filterChain)
  {
    // logica applicata dopo che l'action è stata eseguita
    //if (Yii::app()->params['environment'] == 'PRODUCTION') {
      $logger = Logger::getLogger('eventserver-gui');
      $logger->info("ACTION END - USER:".Yii::app()->user->name." ACTION:".$filterChain->controller->id ."->".$filterChain->action->id." PARAMS:".print_r($filterChain->controller->actionParamsforLog, true));
    //}
    return true;
  }
}
