-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathLogs.pas
58 lines (45 loc) · 879 Bytes
/
Logs.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
unit Logs;
interface
uses
Forms, SysUtils;
procedure MainLog(ls: string; console: byte =1; b: byte =0; e: byte =0);
implementation
uses
Unit1, Sockets, Convert;
const
LOG_FILE = 'SandBox.log';
procedure MainLog(ls: string; console: byte =1; b: byte =0; e: byte =0);
var
i: byte;
ft: textfile;
o: string;
begin
{$I-}
assign(ft, LOG_FILE);
append(ft);
if IOResult <> 0 then
rewrite(ft);
if b>0 then
for i:= 1 to b do
begin
if console > 0 then
MainForm.Log.lines.add('');
writeln(ft, '');
end;
o:= DateToStr(Date)+', '+TimeToStr(Time)+': '+ls;
if console > 0 then
MainForm.Log.lines.add(o);
writeln(ft, o);
if e > 0 then
for i:= 1 to e do
begin
if console > 0 then
MainForm.Log.lines.add('');
writeln(ft,'');
end;
flush(ft);
close(ft);
{$I+}
IOResult;
end;
end.