summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fcfc03f)
raw | patch | inline | side by side (parent: fcfc03f)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Fri, 15 Apr 2016 11:51:36 +0000 (14:51 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Fri, 15 Apr 2016 11:51:36 +0000 (14:51 +0300) |
src/engine/e_log.pas | patch | blob | history |
diff --git a/src/engine/e_log.pas b/src/engine/e_log.pas
index b877db33511abbfde8f1b28c08dec9acac867130..d45f86efd10cb1d10e453a7d754ecb9d7a4f8e49 100644 (file)
--- a/src/engine/e_log.pas
+++ b/src/engine/e_log.pas
+{$R-}
unit e_log;
interface
if FileName = '' then Exit;
Assign(LogFile, FileName);
- if FileExists(FileName) then
- Append(LogFile)
- else
- Rewrite(LogFile);
- if FirstRecord then
- begin
- Writeln(LogFile, '--- Log started at '+TimeToStr(Time)+' ---');
- FirstRecord := False;
- end;
- case RecordCategory of
- MSG_FATALERROR: Prefix := '!!!';
- MSG_WARNING: Prefix := '! ';
- MSG_NOTIFY: Prefix := '***';
+ try
+ if FileExists(FileName) then
+ Append(LogFile)
+ else
+ Rewrite(LogFile);
+ try
+ if FirstRecord then
+ begin
+ Writeln(LogFile, '--- Log started at '+TimeToStr(Time)+' ---');
+ FirstRecord := False;
+ end;
+ case RecordCategory of
+ MSG_FATALERROR: Prefix := '!!!';
+ MSG_WARNING: Prefix := '! ';
+ MSG_NOTIFY: Prefix := '***';
+ end;
+ if WriteTime then
+ Writeln(LogFile, '['+TimeToStr(Time)+'] '+Prefix+' '+TextLine)
+ else
+ Writeln(LogFile, Prefix+' '+TextLine);
+ finally
+ Close(LogFile);
+ end;
+ except // sorry
end;
- if WriteTime then
- Writeln(LogFile, '['+TimeToStr(Time)+'] '+Prefix+' '+TextLine)
- else
- Writeln(LogFile, Prefix+' '+TextLine);
- Close(LogFile);
end;
procedure e_InitLog(fFileName: String; fWriteMode: TWriteMode);