Ver Mensaje Individual
  #3  
Antiguo 04-06-2013
aposi aposi is offline
Miembro
 
Registrado: dic 2006
Posts: 159
Reputación: 20
aposi Va por buen camino
hola,
el siguiente procedimiento genera un fichero por dia con (fecha.log) a ver si te sirve

Código Delphi [-]
procedure TFprincipal.log(Mensaje: String);
var
  F: TextFile;
  Filename: String;
  nombre:string;

begin
  // Damos formato al mensaje
  Mensaje:= FormatDateTime('[ddd dd mmm, hh:nn:ss:zzz] ', Now) + Mensaje;
  nombre := FormatDateTime('yyyymmdd', Now);
  Filename:= ChangeFileExt(nombre,'.log');

  // Aqui abrimos el archivo si existe, o lo creamos sino existe
  AssignFile(F, Filename);
  {$I-}
    Append(F);
  if IOResult <> 0 then
    Rewrite(F);
  {$I+}
  if IOResult = 0 then
  begin
    // Escribimos el mensaje
    Writeln(F,Mensaje);
    CloseFile(F);
  end;

end;
Responder Con Cita