- Mínimo cambio en el formato de logging.
- Cambio de sección de configuración de DB_DataObject a DBO.
[general]
; Nivel de reporte de errores.
error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
-; Nivel de loggeo: L_NON, L_ERR, L_WRN, L_INF, L_DBG, L_ALL
+; Nivel de loggeo: L_NON, L_CRI, L_ERR, L_WRN, L_INF, L_DBG, L_ALL
; (ver T/logconstants.php)
loglevel = L_ALL & ~L_DBG
; Archivo de log (si no se especifica, se usa STDERR)
options = novalidate-cert/ssl
-[DB_DataObject]
+[DBO]
database = sqlite:////var/lib/sercom/corrector.sqlite
schema_location = T/DBO/schema/
class_location = T/DBO/
// because PEAR::getstaticProperty was called with and & (get by reference)
// this will actually set the variable inside that method (a quasi static variable)
-$DBO_options = $CONF['DB_DataObject'];
+$DBO_options = $CONF['DBO'];
//unset($DBO_options);
--- /dev/null
+<?php // vim: set binary noeol et sw=4 sts=4:
+
+function logserr($str, $level = L_ERR) {
+ global $php_errormsg;
+ logs("$str ($php_errormsg)", $level);
+}
+
+function logs($str, $level = L_INF) {
+ global $LOGLEVEL, $LOGFP, $argv;
+ if ($str and $LOGLEVEL & $level) {
+ fputs($LOGFP, sprintf("%s %s[%d] %-8s %s\n", strftime('%c'),
+ basename($argv[0]), getmypid(), loglevel2str($level), $str));
+ }
+}
+
+function loglevel2str($level) {
+ $ret = array();
+ if ($level & L_CRI) {
+ $ret[] = 'CRITICAL';
+ }
+ if ($level & L_ERR) {
+ $ret[] = 'ERROR';
+ }
+ if ($level & L_WRN) {
+ $ret[] = 'WARNING';
+ }
+ if ($level & L_INF) {
+ $ret[] = 'INFO';
+ }
+ if ($level & L_DBG) {
+ $ret[] = 'DEBUG';
+ }
+ if (count($ret) == 1) {
+ return reset($ret);
+ }
+ if ($ret) {
+ return '['.join(',', $ret).']';
+ }
+ return '';
+}
+
+?>
\ No newline at end of file
--- /dev/null
+<?php // vim: set binary noeol et sw=4 sts=4:
+
+define('L_NON', 0);
+define('L_CRI', 1);
+define('L_ERR', 1 << 1);
+define('L_WRN', 1 << 2);
+define('L_INF', 1 << 3);
+define('L_DBG', 1 << 4 );
+define('L_ALL', 0xFFFF);
+#define('L_', );
+
+?>
\ No newline at end of file