00001 <?php
00015 class Registro{
00016
00017 const FICHERO = "/tmp/pax.log";
00018 const FORMATO_FECHA = "Y-m-d H:i:s";
00019
00020
00021 public static $fichero = self::FICHERO;
00022 public static $formatoFecha = self::FORMATO_FECHA;
00023
00027 public static function anotar($msg){
00028 $fichero = fopen(self::$fichero, "a");
00029 if (!$fichero) throw new ExcepcionRegistroAperturaFichero(self::$fichero);
00030 $msg = date(self::FORMATO_FECHA)." - ".$msg."\n";
00031 fwrite($fichero, $msg);
00032 fclose($fichero);
00033 }
00034 }
00035
00037 class ExcepcionRegistroAperturaFichero extends Excepcion{
00038 public function __construct($fichero){
00039 $titulo = "No se ha podido abrir el Registro de Operaciones.";
00040 $texto = "La aplicación no ha podido abrir el fichero '$fichero' para utilizarlo como Registro de Operaciones.";
00041 $solucionProgramador = "Compruebe los permisos sobre el fichero y sobre el directorio del fichero.";
00042 parent::__construct($titulo,$texto,$solucionProgramador);
00043 }
00044 }
00045 return true;
00046 ?>