Next4Me
 All Classes Files Functions Variables
Log.php
1 <?php
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  //echo "<pre>".print_r($cfg)."</pre>";
30  $logPath=$cfg['global']['logPath'];
31  $writer = new Zend_Log_Writer_Stream($logPath);
32  $format = '%timestamp% %priorityName% (%priority%): %message%' . PHP_EOL;
33  $formatter = new Zend_Log_Formatter_Simple($format);
34  $writer->setFormatter($formatter);
35  $logger = new Zend_Log();
36  $logger->addWriter($writer);
37  if($type=='1'){
38  $logger->info($page.' '.$method.' '.$result.' '.$message);
39  }
40  if($type=='3'){
41  $logger->log($page.' '.$method.' '.$result.' '.$message,3);
42  }
43  }
44  catch(Exception $e){
45  echo json_encode(array("resultId"=>1,"resultCode"=>"I have no write permision for file ".$logPath));
46  exit;
47  }
48  }
49  //==== End Log =========================================================================
50  }
51 ?>