10 TWriteMode
=(WM_NEWFILE
, WM_OLDFILE
);
11 TRecordCategory
=(MSG_FATALERROR
, MSG_WARNING
, MSG_NOTIFY
);
13 procedure e_InitLog(fFileName
: String; fWriteMode
: TWriteMode
);
14 procedure e_WriteLog(TextLine
: String; RecordCategory
: TRecordCategory
;
15 WriteTime
: Boolean = True);
16 function DecodeIPV4(ip
: LongWord): string;
26 function DecodeIPV4(ip
: LongWord): string;
28 Result
:= Format('%d.%d.%d.%d', [ip
and $FF, (ip
shr 8) and $FF, (ip
shr 16) and $FF, (ip
shr 24)]);
31 procedure e_WriteLog(TextLine
: String; RecordCategory
: TRecordCategory
;
32 WriteTime
: Boolean = True);
35 Prefix
: ShortString = '';
37 if FileName
= '' then Exit
;
39 Assign(LogFile
, FileName
);
41 if FileExists(FileName
) then
48 Writeln(LogFile
, '--- Log started at '+TimeToStr(Time
)+' ---');
51 case RecordCategory
of
52 MSG_FATALERROR
: Prefix
:= '!!!';
53 MSG_WARNING
: Prefix
:= '! ';
54 MSG_NOTIFY
: Prefix
:= '***';
57 Writeln(LogFile
, '['+TimeToStr(Time
)+'] '+Prefix
+' '+TextLine
)
59 Writeln(LogFile
, Prefix
+' '+TextLine
);
67 procedure e_InitLog(fFileName
: String; fWriteMode
: TWriteMode
);
69 FileName
:= fFileName
;
70 if fWriteMode
= WM_NEWFILE
then
73 if FileExists(FileName
) then DeleteFile(FileName
);