Next4Me
 All Classes Files Functions Variables
Logging.php
Go to the documentation of this file.
1 <?php
11 class Log
12  {
13  //==== Start Log =========================================================================
25  public function save($page,$method,$result,$message,$type)
26  {
27  try{
28  $cfg=Zend_Controller_Front::getInstance()->getParam('bootstrap')->getOptions();
29  $logPath=$cfg['global']['logPath'];
30  $writer = new Zend_Log_Writer_Stream($logPath);
31  $format = '%timestamp% %priorityName% (%priority%): %message%' . PHP_EOL;
32  $formatter = new Zend_Log_Formatter_Simple($format);
33  $writer->setFormatter($formatter);
34  $logger = new Zend_Log();
35  $logger->addWriter($writer);
36  if($type=='1'){
37  $logger->info($page.' '.$method.' '.$result.' '.$message);
38  }
39  if($type=='3'){
40  $logger->log($page.' '.$method.' '.$result.' '.$message,3);
41  }
42  }
43  catch(Exception $e){
44  echo json_encode(array("resultId"=>1,"resultCode"=>"I have no write permision for file ".$logPath));
45  exit;
46  }
47  }
48  //==== End Log =========================================================================
49  }
50 ?>