mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Changes on log result
This commit is contained in:
parent
14aa8083cb
commit
0177d1906d
@ -1883,11 +1883,14 @@ sub grep_logs {
|
|||||||
# Create index file if it does not exist
|
# Create index file if it does not exist
|
||||||
my $idx_file = $idx_dir.$module_name."_".basename($log_file).".idx";
|
my $idx_file = $idx_dir.$module_name."_".basename($log_file).".idx";
|
||||||
if (! -e $idx_file) {
|
if (! -e $idx_file) {
|
||||||
create_idx();
|
return if create_idx() == 1;
|
||||||
} else{
|
} else{
|
||||||
return if load_idx() == 1;
|
return if load_idx() == 1;
|
||||||
|
my $result = parse_log();
|
||||||
|
|
||||||
return if parse_log() == 1;
|
return if $result == 1;
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Start the function definition
|
# Start the function definition
|
||||||
@ -1957,6 +1960,7 @@ sub grep_logs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub parse_log {
|
sub parse_log {
|
||||||
|
my $result = "";
|
||||||
my $line;
|
my $line;
|
||||||
|
|
||||||
log_message("module_logger", "Parsing log file $log_file");
|
log_message("module_logger", "Parsing log file $log_file");
|
||||||
@ -1970,10 +1974,10 @@ sub grep_logs {
|
|||||||
# Go to starting position.
|
# Go to starting position.
|
||||||
seek(LOGFILE, $idx_pos, 0);
|
seek(LOGFILE, $idx_pos, 0);
|
||||||
|
|
||||||
print STDOUT "<module>\n";
|
$result = $result . "<module>\n";
|
||||||
print STDOUT "<name><![CDATA[" . $module_name . "]]></name>\n";
|
$result = $result . "<name><![CDATA[" . $module_name . "]]></name>\n";
|
||||||
print STDOUT "<type><![CDATA[async_string]]></type>\n";
|
$result = $result . "<type><![CDATA[async_string]]></type>\n";
|
||||||
print STDOUT "<datalist>\n";
|
$result = $result . "<datalist>\n";
|
||||||
|
|
||||||
# Parse log file
|
# Parse log file
|
||||||
while ($line = <LOGFILE>) {
|
while ($line = <LOGFILE>) {
|
||||||
@ -1981,20 +1985,21 @@ sub grep_logs {
|
|||||||
# Remove the trailing '\n'
|
# Remove the trailing '\n'
|
||||||
chop($line);
|
chop($line);
|
||||||
|
|
||||||
print STDOUT "<data><value><![CDATA[$line]]></value></data>\n";
|
$result = $result . "<data><value><![CDATA[$line]]></value></data>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print STDOUT "</datalist>\n";
|
$result = $result . "</datalist>\n";
|
||||||
print STDOUT "</module>\n";
|
$result = $result . "</module>\n";
|
||||||
|
|
||||||
$idx_pos = tell(LOGFILE);
|
$idx_pos = tell(LOGFILE);
|
||||||
close(LOGFILE);
|
close(LOGFILE);
|
||||||
|
|
||||||
|
print($result);
|
||||||
# Save the index file
|
# Save the index file
|
||||||
return 1 if save_idx() == 1;
|
return 1 if save_idx() == 1;
|
||||||
|
|
||||||
return 0;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user