-
Notifications
You must be signed in to change notification settings - Fork 5
/
debuglogviewer.pas
78 lines (62 loc) · 1.62 KB
/
debuglogviewer.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
unit debuglogviewer;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,applicationformconfig;
type
TDebugLogForm = class(TVideLibriForm)
Memo1: TMemo;
Timer1: TTimer;
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
procedure DebugLogFormLog(message: string);
{ private declarations }
public
{ public declarations }
end;
var
DebugLogForm: TDebugLogForm;
implementation
uses bbdebugtools, applicationdesktopconfig;
procedure TDebugLogForm.FormShow(Sender: TObject);
begin
Timer1Timer(sender);
end;
var logModified: boolean;
procedure TDebugLogForm.FormCreate(Sender: TObject);
begin
bbdebugtools.OnLog:=@DebugLogFormLog;
logModified := true;
if not logging then begin
logging:=true;
log('Debug logging started');
end;
memo1.Lines.Add('Debug Log File: ' + logFileName);
end;
procedure TDebugLogForm.Timer1Timer(Sender: TObject);
var
temp: TStringList;
tempstream: TFileStream;
begin
if logModified then begin
logModified := false;
temp := TStringList.Create;
tempstream:=TFileStream.Create(logFileName,fmOpenRead or fmShareDenyNone);
temp.LoadFromStream(tempstream);
tempstream.free;
memo1.Lines.BeginUpdate;
while temp.Count > memo1.lines.Count do
memo1.Lines.add(temp[memo1.Lines.Count]);
memo1.Lines.EndUpdate;
temp.free;
end;
end;
procedure TDebugLogForm.DebugLogFormLog(message: string);
begin
logModified := true;
end;
initialization
{$I debuglogviewer.lrs}
end.