Logging activities - (not pretty!!)

ini saya buat untuk logging, di taruh di app_controller.php.. sangat buruk..tapi jalan.

function afterFilter() {


     // this is a call for logging -- not very pretty. - but it works     


     App::import('Model', 'Entry');    


     $tmpEntry = new Entry();    


     $logthis = $this->Auth->user('username').' is accessing '.$this->params['action'].' in module '.$this->params['controller'].'-'.Router::url();    


     $this->set('accessme',$tmpEntry->query("insert into actlogs values ('','$logthis',now())"));


     unset($tmpEntry); 


     }




 



ini kalau mau di setiap controller.





$logthis = $this->Auth->user('username').' is accessing '.$this->params['action'].' in module '.$this->params['controller'].'- id number:'.$id; 


$this->Log($logthis,'Activity');


0 komentar:

Posting Komentar