';
$inicioHtml.= '
Debugger de la aplicación '.strtoupper($valorAplicacion).'
';
$inicioHtml.= '
';
//Lectura de parametros desde negocio
$valorFecha = IgepSession::dameVariable('gvHidraDebugger','valorFechaIni');
if(!is_object($valorFecha))
{
$valorFecha = new gvHidraTimestamp('now');
}
$fechaUserIni = $valorFecha->format('d/m/Y H:i');
$valorFechaFin = IgepSession::dameVariable('gvHidraDebugger','valorFechaFin');
if(!is_object($valorFechaFin))
{
$valorFechaFin = new gvHidraTimestamp('+1 h');
}
$fechaUserFin = $valorFechaFin->format('d/m/Y H:i');
//para el tipo
$selected0 = '';$selected1 = '';$selected2 = '';$selected3 = '';$selected4 = '';$selected5 = '';
$valorTipo = IgepSession::dameVariable('gvHidraDebugger','valorTipo');
$selected = 'selected'.$valorTipo;
$$selected = 'selected';
$errorDebugger = '';
$valorUsuario = IgepSession::dameVariable('gvHidraDebugger', 'valorUsuario');
if (empty($valorUsuario))
{
$valorUsuario = IgepSession::dameUsuario();
}
$strAccion = IgepSession::dameVariable('gvHidraDebugger','strAccion');
$query = IgepSession::dameVariable('gvHidraDebugger', 'query');
$vTypesWhere = IgepSession::dameVariable('gvHidraDebugger', 'vTypesWhere');
$vTypesSelect = IgepSession::dameVariable('gvHidraDebugger', 'vTypesSelect');
if ($strAccion == 'refreshDebugger')//Hay que buscar
{
//Conexión
try
{
$conf = ConfigFramework::getConfig();
$formatoDateTimeUser = $conf->getDateMaskUser().' '.$conf->getTimeMask();
$dsn_log = $conf->getDSNLog();
$codificacion = 'UTF-8';
if (isset($dsn_log['xmlcharset']))
{
$codificacion = $dsn_log['xmlcharset'];
}
$driver = gvHidraDBAL::MDB2_DRIVER;
if (mb_strtoupper(trim($dsn_log['driver']), 'UTF-8') == 'PDO')
{
$driver = gvHidraDBAL::PDO_DRIVER;
}
$dbms = $dsn_log['xmltype'];
if ($dbms == 'sqlite')
{
try
{
$dsn_log['xmlOrig'] = $dsn_log['xmlhost'];
$dsn_log['xmlhost'] = IgepDebug::getSqlitePDOResource($dsn_log);
}
catch (Exception $e)
{
$msg = 'Error con el uso de SQLite para el DEBUG: '.$e->getMessage();
throw new Exception($msg);
}
}
//$conDBAL = new gvHidraDBAL($dsn_log, $codificacion, $driver);
$conDBAL = gvHidraDBAL::makeConnection($dsn_log, $codificacion, $driver);
}
catch (Exception $e)
{
$mensaje = __CLASS__.'::'.__METHOD__.': Error en la reconexión del debug. Descripción del problema es: '.$e->getMessage();
$errorDebugger = $mensaje;
throw $e;
}
$vValuesWhere = IgepSession::dameVariable('gvHidraDebugger','vValuesWhere');
$formatoTimestampBD = $conDBAL->getMask('timestamp','php');//Obtenemos el formato con el que trabaja este SGBD
$fechabdIni = $valorFecha->format($formatoTimestampBD);
$fechabdFin = $valorFechaFin->format($formatoTimestampBD);
$vValuesWhere = array
(
'aplicacion' => $valorAplicacion,
'fechaIni' => $fechabdIni,
'fechaFin' => $fechabdFin,
'tipo' => $valorTipo,
'usuario' => $valorUsuario
);
try
{
$conDBAL->prepare($query, $vTypesWhere, $vTypesSelect);
}
catch (Exception $e)
{
$mensaje = __CLASS__.': Error al preparar la consulta SQL: '.$e->getMessage();
$errorDebugger = $mensaje;
}
try
{
if ($dbms == 'sqlite') $vValuesWhere['usuario'] = '%';//El usuario filtr la BD, no es una columna real
$conDBAL->execute($vValuesWhere);
}
catch (Exception $e)
{
$mensaje = __CLASS__.': Error al lanzar la consulta SQL: '.$e->getMessage();
$errorDebugger = $mensaje;
}
}
print($inicioHtml);
if($errorDebugger!='')
{
$htmlResult.= '
';
$htmlResult.= ' '.$errorDebugger.'';
$htmlResult.= '
';
}
$htmlResult.= '
';
$htmlResult.= '
';
$htmlResult.= '';
$htmlResult.= '
';
$htmlResult.= '
Traza de ejecución
';
$htmlResult.= '
';
$htmlResult.= '
';
$htmlResult.= '
';
$htmlResult.= '';
$htmlResult.= '';
$htmlResult.= 'Nº';
$htmlResult.= ' | ';
$htmlResult.= '';
$htmlResult.= 'FECHA';
$htmlResult.= ' | ';
if(empty($valorUsuario))
{
$htmlResult.= '';
$htmlResult.= 'USUARIO';
$htmlResult.= ' | ';
}
$htmlResult.= '';
$htmlResult.= 'TIPO';
$htmlResult.= ' | ';
$htmlResult.= '';
$htmlResult.= 'MENSAJE';
$htmlResult.= ' | ';
$htmlResult.= '
';
$indice = 0;
if (($strAccion == 'refreshDebugger') && (empty($errorDebugger)))
{
while (($tupla = $conDBAL->fetch()))
{
$htmlResult.= '';
$htmlResult.= '';
$htmlResult.= ($indice++);
$htmlResult.= ' | ';
$htmlResult.= '';
if (!empty($tupla['fecha']))
{
$formatoTimestampSalidaBD = $conDBAL->getMask('timestamp','php');
$fecha = DateTime::createFromFormat ($formatoTimestampSalidaBD, ($tupla['fecha']));
if ($fecha !== false)
{
$htmlResult.= $fecha->format($formatoDateTimeUser);
}
else
{
$htmlResult.=$formatoTimestampSalidaBD.'? '.$tupla['fecha'];
}
}
$htmlResult.= ' | ';
if(empty($valorUsuario))
{
$htmlResult.= '';
$htmlResult.= $tupla['usuario'];
$htmlResult.= ' | ';
}
$htmlResult.= '';
switch($tupla['tipo'])
{
case 0:
$htmlResult.= 'PANIC';
break;
case 1:
$htmlResult.= 'ERROR';
break;
case 2:
$htmlResult.= 'WARNING';
break;
case 3:
$htmlResult.= 'NOTICE';
break;
case 4:
$htmlResult.= 'DEBUG_USER';
break;
case 5:
$htmlResult.= 'DEBUG_IGEP';
break;
}
$htmlResult.= ' | ';
$htmlResult.= '';
$mensaje = ($tupla['mensaje']);
if (is_resource($mensaje))//Blob
{
$mensaje = stream_get_contents($mensaje);
}
$htmlResult.= $mensaje;
$htmlResult.= ' | ';
$htmlResult.= '
';
}//Fin while
}
if ($indice==0)
{
$htmlResult.= '';
if(empty($valorUsuario))
{
$htmlResult.= '';
}
else
{
$htmlResult.= ' | ';
}
$htmlResult.= ' ';
$htmlResult.= 'NO HAY DATOS ';
$htmlResult.= ' | ';
$htmlResult.= '
';
}
$htmlResult.= '
';
$htmlResult.= '
';
$htmlResult.= '
';
$htmlResult.= '';
$htmlResult.= '