Next4Me
 All Data Structures Files Functions Variables
application/models/logging.php
Go to the documentation of this file.
00001 <?
00011 class Log 
00012  {  
00013     //==== Start Log =========================================================================
00025      public function save($page,$method,$result,$message,$type)
00026      {
00027          try{
00028          $cfg=Zend_Controller_Front::getInstance()->getParam('bootstrap')->getOptions();
00029             $logPath=$cfg['global']['logPath'];
00030             $writer = new Zend_Log_Writer_Stream($logPath);
00031             $format = '%timestamp%  %priorityName% (%priority%): %message%' . PHP_EOL;
00032             $formatter = new Zend_Log_Formatter_Simple($format);
00033             $writer->setFormatter($formatter);
00034             $logger = new Zend_Log();
00035             $logger->addWriter($writer);
00036             if($type=='1'){
00037             $logger->info($page.' '.$method.' '.$result.' '.$message);
00038             }
00039             if($type=='3'){
00040             $logger->log($page.' '.$method.' '.$result.' '.$message,3);
00041             }
00042          }
00043          catch(Exception $e){
00044              echo json_encode(array("resultId"=>1,"resultCode"=>"I have no write permision for file ".$logPath));
00045              exit;
00046          }
00047      }
00048      //==== End Log =========================================================================
00049  }
00050 ?>