*
PANIC 0
* ERROR 1
* WARNING 2
* NOTICE 3
* DEBUG_USER 4
* DEBUG_IGEP 5
*
*
* @version $Id: IgepDebug.php,v 1.23 2008-05-02 12:27:51 gaspar Exp $
* @author Toni:
* @package igep
*/
class IgepDebug{
static function setDebug($tipo,$mensaje){
global $g_log;
include_once "IgepConstants.php";
$configuration = ConfigFramework::getConfig();
$debug = $configuration->getLogStatus();
//Comprobamos si tenemos que insertar
if($tipo>=$debug)
return;
//Obtenemos los datos
$aplicacion = IgepSession::dameAplicacion();
$modulo = '';
$version = G_VERSION;
$usuario = IgepSession::dameUsuario();
//Realizamos la insercion
IgepDebug::_setDB($tipo, $mensaje, $aplicacion, $modulo, $version, $usuario);
}
static function _setDB($tipo, $mensaje, $aplicacion, $modulo, $version, $usuario){
include_once "IgepConexion.php";
$conf = ConfigFramework::getConfig();
$dsn_log = $conf->getDSN('gvh_dsn_log');
if(empty($dsn_log))
return;
$conexion = new IgepConexion($dsn_log);
//Obtenemos la fecha en el formato que admita la BD
$fechabd = IgepDB::mascaraFechas($dsn_log);
$fecha = date($fechabd.' H:i:s');
$sql = IgepDB::obtenerSecuenciaBD($dsn_log,'scmn_id_errlog');
$resc = $conexion->obj_conexion->query($sql);
if(PEAR::isError($resc))
$iderror = -1;
else
$iderror = $resc->fetchOne('nextval');
if($iderror!=-1){
$conexion->prepararOperacion($mensaje);
$res = $conexion->obj_conexion->exec("INSERT INTO tcmn_errlog (iderror,aplicacion,modulo,version,usuario,fecha,tipo,mensaje) values($iderror,'".$aplicacion."',null,'".$version."','".$usuario."','".$fecha."','".$tipo."','".$mensaje."')");
}
unset($conexion);
}
}
?>