Location: PHPKode > projects > DarkCity > includes/LogManager.php
<?php
/**
 * LogManager.php : Manager pour les messages de logs
 *
 * Date    : 31/05/2009
 * Auteur  : Philippe Bousquet
 * Version : 1.0
 * Contact : <hide@address.com>
 *
 * Copyright (c) 2008-2009 Philippe & Thierry Bousquet.
 *
 * Ce logiciel est distribué selon les termes de la GNU General Public License v2.
 */

class LogManager {
  
  /** fichier */
  var $fichier = "logs/messages.log";
  var $fichierPerf = "logs/performance.csv";
  
  /** log active */
  var $active = 0;
  var $activePerf = 0;
  
  function LogManager() {
   
  }
  
  function isActive() {
    return $this->active;
  }
  
  function setActive($active) {
    $this->active = $active;
  }

  function isActivePerf() {
    return $this->activePerf;
  }
  
  function setActivePerf($activePerf) {
    $this->activePerf = $activePerf;
  }
  
  function message($message) {
    if ($this->isActive()) {
    	$fd = fopen($this->fichier, "a");
    	fwrite($fd, date("Y-m-d H:i:s")." ".$message."\n"); 
    	fclose($fd);
    }
  }
  function tracePerf($page, $action, $timer) {
    if ($this->isActivePerf()) {
    	$fd = fopen($this->fichierPerf, "a");
    	fwrite($fd, date("Y-m-d H:i:s").";".$page.";".$action.";".$timer."\n"); 
    	fclose($fd);
    }
  }
}
?>
Return current item: DarkCity