3 {$INCLUDE ../shared/a_modes.inc}
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 procedure e_WriteStackTrace (const msg
: AnsiString);
18 function DecodeIPV4(ip
: LongWord): string;
28 function DecodeIPV4(ip
: LongWord): string;
30 Result
:= Format('%d.%d.%d.%d', [ip
and $FF, (ip
shr 8) and $FF, (ip
shr 16) and $FF, (ip
shr 24)]);
33 procedure e_WriteLog(TextLine
: String; RecordCategory
: TRecordCategory
;
34 WriteTime
: Boolean = True);
39 if FileName
= '' then Exit
;
41 Assign(LogFile
, FileName
);
42 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
);
64 procedure e_WriteStackTrace (const msg
: AnsiString);
65 var LogFile
: TextFile
;
67 e_WriteLog(msg
, TRecordCategory
.MSG_FATALERROR
);
69 Assign(LogFile
, FileName
);
70 if FileExists(FileName
) then
75 writeln(LogFile
, '=====================');
76 DumpExceptionBackTrace(LogFile
);
81 procedure e_InitLog(fFileName
: String; fWriteMode
: TWriteMode
);
83 FileName
:= fFileName
;
84 if fWriteMode
= WM_NEWFILE
then
85 if FileExists(FileName
) then