Extracted file reading
This commit is contained in:
parent
c62d4fae0c
commit
1aaf0beb2b
39
UApp.pas
39
UApp.pas
|
@ -45,6 +45,9 @@ type
|
||||||
procedure WriteContent(AContent: String; AFilters: TFilterList;
|
procedure WriteContent(AContent: String; AFilters: TFilterList;
|
||||||
AGroupRanges: TGroupRanges);
|
AGroupRanges: TGroupRanges);
|
||||||
procedure FilterLine(ALine: String);
|
procedure FilterLine(ALine: String);
|
||||||
|
//Logfile handling
|
||||||
|
procedure DumpFile(AFileName: String);
|
||||||
|
procedure PollFile(AFileName: String);
|
||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
@ -58,7 +61,6 @@ implementation
|
||||||
procedure TLogFilterApplication.DoRun;
|
procedure TLogFilterApplication.DoRun;
|
||||||
var
|
var
|
||||||
commandFile: TextFile;
|
commandFile: TextFile;
|
||||||
logFile: TextFile;
|
|
||||||
line: String;
|
line: String;
|
||||||
begin
|
begin
|
||||||
if HasOption('h', 'help') or not HasOption('c', 'commandfile') then
|
if HasOption('h', 'help') or not HasOption('c', 'commandfile') then
|
||||||
|
@ -107,17 +109,7 @@ begin
|
||||||
if HasOption('html') then
|
if HasOption('html') then
|
||||||
FWriter.Add(THTMLWriter.Create(GetOptionValue('html')));
|
FWriter.Add(THTMLWriter.Create(GetOptionValue('html')));
|
||||||
|
|
||||||
AssignFile(logFile, FLogFileName);
|
DumpFile(FLogFileName);
|
||||||
Reset(logFile);
|
|
||||||
|
|
||||||
// Filter log
|
|
||||||
while not EOF(logFile) do
|
|
||||||
begin
|
|
||||||
Readln(logFile, line);
|
|
||||||
FilterLine(line);
|
|
||||||
end;
|
|
||||||
|
|
||||||
CloseFile(logFile);
|
|
||||||
|
|
||||||
// One run is enough.
|
// One run is enough.
|
||||||
Terminate;
|
Terminate;
|
||||||
|
@ -232,6 +224,29 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TLogFilterApplication.DumpFile(AFileName: String);
|
||||||
|
var
|
||||||
|
logFile: TextFile;
|
||||||
|
line: String;
|
||||||
|
begin
|
||||||
|
AssignFile(logFile, AFileName);
|
||||||
|
Reset(logFile);
|
||||||
|
|
||||||
|
// Filter log
|
||||||
|
while not EOF(logFile) do
|
||||||
|
begin
|
||||||
|
Readln(logFile, line);
|
||||||
|
FilterLine(line);
|
||||||
|
end;
|
||||||
|
|
||||||
|
CloseFile(logFile);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TLogFilterApplication.PollFile(AFileName: String);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
constructor TLogFilterApplication.Create(TheOwner: TComponent);
|
constructor TLogFilterApplication.Create(TheOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
|
|
Loading…
Reference in New Issue