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;
19 e_WriteToStdOut
: Boolean = False;
29 function DecodeIPV4(ip
: LongWord
): string;
31 Result
:= Format('%d.%d.%d.%d', [ip
and $FF, (ip
shr 8) and $FF, (ip
shr 16) and $FF, (ip
shr 24)]);
34 procedure e_WriteLog(TextLine
: String; RecordCategory
: TRecordCategory
;
35 WriteTime
: Boolean = True);
38 Prefix
: ShortString
= '';
41 if FileName
= '' then Exit
;
43 Assign(LogFile
, FileName
);
45 if FileExists(FileName
) then
52 Writeln(LogFile
, '--- Log started at '+TimeToStr(Time
)+' ---');
55 case RecordCategory
of
56 MSG_FATALERROR
: Prefix
:= '!!!';
57 MSG_WARNING
: Prefix
:= '! ';
58 MSG_NOTIFY
: Prefix
:= '***';
61 OutStr
:= '['+TimeToStr(Time
)+'] '+Prefix
+' '+TextLine
63 OutStr
:= Prefix
+' '+TextLine
;
64 Writeln(LogFile
, OutStr
);
65 if e_WriteToStdOut
then
74 procedure e_InitLog(fFileName
: String; fWriteMode
: TWriteMode
);
76 FileName
:= fFileName
;
77 if fWriteMode
= WM_NEWFILE
then
80 if FileExists(FileName
) then DeleteFile(FileName
);