1a2499060453086ace60781d3c3b85e7fabd995d
11 TWriteMode
=(WM_NEWFILE
, WM_OLDFILE
);
12 TRecordCategory
=(MSG_FATALERROR
, MSG_WARNING
, MSG_NOTIFY
);
14 procedure e_InitLog(fFileName
: String; fWriteMode
: TWriteMode
);
15 procedure e_WriteLog(TextLine
: String; RecordCategory
: TRecordCategory
;
16 WriteTime
: Boolean = True);
17 function DecodeIPV4(ip
: LongWord): string;
20 e_WriteToStdOut
: Boolean = False;
30 function DecodeIPV4(ip
: LongWord): string;
32 Result
:= Format('%d.%d.%d.%d', [ip
and $FF, (ip
shr 8) and $FF, (ip
shr 16) and $FF, (ip
shr 24)]);
35 procedure e_WriteLog(TextLine
: String; RecordCategory
: TRecordCategory
;
36 WriteTime
: Boolean = True);
39 Prefix
: ShortString = '';
42 if FileName
= '' then Exit
;
44 Assign(LogFile
, FileName
);
46 if FileExists(FileName
) then
53 Writeln(LogFile
, '--- Log started at '+TimeToStr(Time
)+' ---');
56 case RecordCategory
of
57 MSG_FATALERROR
: Prefix
:= '!!!';
58 MSG_WARNING
: Prefix
:= '! ';
59 MSG_NOTIFY
: Prefix
:= '***';
62 OutStr
:= '['+TimeToStr(Time
)+'] '+Prefix
+' '+TextLine
64 OutStr
:= Prefix
+' '+TextLine
;
65 Writeln(LogFile
, OutStr
);
66 if e_WriteToStdOut
then
75 procedure e_InitLog(fFileName
: String; fWriteMode
: TWriteMode
);
77 FileName
:= fFileName
;
78 if fWriteMode
= WM_NEWFILE
then
81 if FileExists(FileName
) then DeleteFile(FileName
);