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;
|
||||
AGroupRanges: TGroupRanges);
|
||||
procedure FilterLine(ALine: String);
|
||||
//Logfile handling
|
||||
procedure DumpFile(AFileName: String);
|
||||
procedure PollFile(AFileName: String);
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
|
@ -58,7 +61,6 @@ implementation
|
|||
procedure TLogFilterApplication.DoRun;
|
||||
var
|
||||
commandFile: TextFile;
|
||||
logFile: TextFile;
|
||||
line: String;
|
||||
begin
|
||||
if HasOption('h', 'help') or not HasOption('c', 'commandfile') then
|
||||
|
@ -107,17 +109,7 @@ begin
|
|||
if HasOption('html') then
|
||||
FWriter.Add(THTMLWriter.Create(GetOptionValue('html')));
|
||||
|
||||
AssignFile(logFile, FLogFileName);
|
||||
Reset(logFile);
|
||||
|
||||
// Filter log
|
||||
while not EOF(logFile) do
|
||||
begin
|
||||
Readln(logFile, line);
|
||||
FilterLine(line);
|
||||
end;
|
||||
|
||||
CloseFile(logFile);
|
||||
DumpFile(FLogFileName);
|
||||
|
||||
// One run is enough.
|
||||
Terminate;
|
||||
|
@ -232,6 +224,29 @@ begin
|
|||
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);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
|
|
Loading…
Reference in New Issue