35 lines
2.1 KiB
PHP
35 lines
2.1 KiB
PHP
<?php
|
|
class Metier_Util_Log
|
|
{
|
|
/**
|
|
* Enregistrer une information dans la log
|
|
* @param string $level E=Error, W=Warning, N=Notice, I=Info, D=Debug
|
|
* @param string $message Message d'erreur à inscrire dans la log
|
|
* @param integer $line __LINE__
|
|
* @param string $file __FILE__
|
|
* @param string $function __FUNCTION__
|
|
* @param string $class __CLASS___
|
|
*/
|
|
public static function write($level, $message, $line, $file, $function, $class)
|
|
{
|
|
if ($level=='E'){
|
|
if (!file_exists(LOG_PATH.'/debugError.log')) {
|
|
file_put_contents(LOG_PATH.'/debugError.log', 'Date/Heure;Niveau;Script;Login;Password;Adresse IP;Action SOAP;Ligne;Fichier;Fonction;Classe;Domaine;POST DATA;Message'.PHP_EOL);
|
|
} else {
|
|
file_put_contents(LOG_PATH.'/debugError.log', date('Y/m/d-H:i:s') .';'. $level .';'. $_SERVER['PHP_SELF'] .';'. $_SERVER['PHP_AUTH_USER'] .';'. $_SERVER['PHP_AUTH_PW'] .';'.
|
|
$_SERVER['REMOTE_ADDR'] .';'. $_SERVER['HTTP_SOAPACTION'] .';'.$line.';'. $file.';'. $function.';'. $class .';'.
|
|
@gethostbyaddr($_SERVER['REMOTE_ADDR']) .';'. 'php://input' .';'. @memory_get_usage().';'. $message . "\n", FILE_APPEND);
|
|
}
|
|
} else {
|
|
if (!file_exists(LOG_PATH.'/debug.log')) {
|
|
file_put_contents(LOG_PATH.'/debug.log', 'Date/Heure;Niveau;Script;Login;Password;Adresse IP;Action SOAP;Ligne;Fichier;Fonction;Classe;Domaine;POST DATA;Memory;Message'.PHP_EOL);
|
|
} else {
|
|
file_put_contents(LOG_PATH.'/debug.log',
|
|
date('Y/m/d-H:i:s') .';'. $level .';'. $_SERVER['PHP_SELF'] .';'. $_SERVER['PHP_AUTH_USER'] .';'.
|
|
$_SERVER['PHP_AUTH_PW'] .';'. $_SERVER['REMOTE_ADDR'] .';'. $_SERVER['HTTP_SOAPACTION'] .';'.
|
|
$line.';'. $file.';'. $function.';'. $class .';'. @gethostbyaddr($_SERVER['REMOTE_ADDR']) .';'.
|
|
'php://input' .';'. @memory_get_usage().';'. $message . "\n", FILE_APPEND);
|
|
}
|
|
}
|
|
}
|
|
} |