Registriert seit: 6. Apr 2005
10.109 Beiträge
|
Re: Datumsänderung mitbekommen
5. Nov 2005, 10:57
Hallo Andreas,
du kannst in der Schreibroutine prüfen, ob der richtige LogFile existiert:
Delphi-Quellcode:
var
logFile: TextFile;
function CurrentLogFileName: string;
begin
Result := ChangeFileExt(DateToStr(Now), '.log');
end;
procedure Log (msg: string);
var
dt: TDateTime;
lfn: string;
begin
lfn := CurrentLogFileName;
if FileExists (lfn) then
Append (logFile)
else begin
AssignFile(logFile, lfn);
Rewrite (logFile);
end;
dt := now;
if msg = '' then
WriteLn(logFile)
else begin
Write(logFile, FormatDateTime('yyyy-mm-dd', dt), ' ');
Write(logFile, FormatDateTime('hh:mm:ss', dt), ': ');
WriteLn(logFile, Translate(msg, #13#10, #32#32));
end;
CloseFile (logFile);
end;
Grüße vom marabu
|
|
Zitat
|