*
PANIC 0
* ERROR 1
* WARNING 2
* NOTICE 3
* DEBUG_USER 4
* DEBUG_IGEP 5
*
*
* @version $Id: IgepDebug.php,v 1.10 2006-06-05 11:25:45 afelixf Exp $
* @author Toni:
* @package igep
*/
class IgepDebug{
function setDebug($tipo,$mensaje){
global $g_log;
include_once "IgepConstants.php";
$debug = (empty($g_log))?LOG_ERRORS:$g_log;
//Comprobamos si tenemos que insertar
if($tipo>=$debug)
return;
//Obtenemos los datos
global $g_aplicacion;
$aplicacion = $g_aplicacion;
$modulo = '';
$version = G_VERSION;
$usuario = IgepSession::dameUsuario();
$fecha = date('d/m/Y H:i:s');
//Realizamos la insercion
IgepDebug::_setDB($tipo, $mensaje, $aplicacion, $modulo, $version, $usuario, $fecha);
}
function _setDB($tipo, $mensaje, $aplicacion, $modulo, $version, $usuario, $fecha){
global $g_dsn_log;
include_once "IgepConexion.php";
$conexion = & new IgepConexion($g_dsn_log);
$sql = IgepDB::obtenerSecuenciaBD($g_dsn_log,'scmn_id_errlog');
$res = $conexion->obj_conexion->getAll($sql,null,DB_FETCHMODE_ASSOC);
$iderror = $res[0]['nextval'];
if($iderror!=-1){
$conexion->prepararOperacion($mensaje);
$res = $conexion->obj_conexion->simpleQuery("INSERT INTO comun.tcmn_errlog (iderror,aplicacion,modulo,version,usuario,fecha,tipo,mensaje) values($iderror,'".$aplicacion."',null,'".$version."','".$usuario."','".$fecha."','".$tipo."','".$mensaje."')");
}
unset($conexion);
}
}
?>