ldc-espri-restauration/wp-content/plugins/wordpress-plugins-versions-checker/logger.class.php
2017-11-15 16:23:10 +01:00

48 lines
998 B
PHP

<?php
// --- Les niveaux de LOG
DEFINE ("ERR_NOTICE", 0) ;
DEFINE ("ERR_DEBUG", 1) ;
DEFINE ("ERR_WARNING", 2) ;
DEFINE ("ERR_ERROR", 3) ;
Class logger
{
var $iLogLevel ;
var $zLogFilePath ;
var $iLogFd ;
// --- Initialisation
function __construct ($_zLogFilePath = "")
{
$this->zLogFilePath = $_zLogFilePath ;
$this->iLogLevel = ERR_DEBUG ;
$this->iLogFd = FALSE ;
}
// --- Ecriture d'un message d'erreur dans le Log
function writeLog ($_zLogMsg, $iLogLevel = ERR_DEBUG)
{
$this->iLogFd = fopen ($this->zLogFilePath, "a+") ;
$zLogMsg = "";
$zLogMsg = date ("[d/m/Y - h:i:s]") ;
switch ($iLogLevel)
{
case ERR_NOTICE :
$zLogMsg .= "[NOTICE]" ;
break ;
case ERR_DEBUG :
$zLogMsg .= "" ;
break ;
case ERR_WARNING :
$zLogMsg .= "[WARNING]" ;
break ;
case ERR_ERROR :
$zLogMsg .= "[ERROR]" ;
break ;
}
$zLogMsg .= $_zLogMsg . "\n" ;
@fwrite ($this->iLogFd, $zLogMsg) ;
}
}
?>