Commit 8b72efa2 authored by Aleš Horák's avatar Aleš Horák
Browse files

* ignore background movements in log

* automatic ssh to pepper
parent 9190cc77
......@@ -9,6 +9,7 @@ use File::Tail;
use Getopt::Long;
use Term::ANSIColor;
use POSIX qw{strftime};
use Sys::Hostname;
no warnings 'once';
......@@ -18,13 +19,21 @@ $keep_also_nonfiltered=undef
$show_microseconds=undef;
$filter=undef;
$last_lines=undef;
$background_filter=1;
$pepper_hostname='Karel';
$pepper_ssh_name='karel';
GetOptions ("debug" => \$debug, "with-filename|H" => \$with_filename,
"keep_also_nonfiltered" => \$keep_also_nonfiltered,
"microseconds" => \$show_microseconds,
"filter=s@" => \$filter,
"background_filter!" => \$background_filter,
"tail" => \$last_lines)
or die("Error in command line arguments\n");
if (hostname() ne $pepper_hostname) {
exit (not(system("ssh $pepper_ssh_name /home/nao/bin/logview @ARGV")==0));
}
$background_filter='(HeadPositionAdjustment|NeckSetsuden|ExpressiveConfiguration|ALSignsAndFeedback.*Ears|ALSignsAndFeedback.*Eyes|ALSignsAndFeedback.*SpeechRecognitionBip)' if $background_filter;
@filters=();
if ($filter and @$filter) {
for my $f (@$filter) {
......@@ -70,6 +79,7 @@ foreach (@logfiles) {
}
$keep_also_nonfiltered = 1 unless @filters;
$| = 1; # autoflush
$background_printed=0;
while (1) {
$nfound=File::Tail::select(undef,undef,undef,60,@files);
unless ($nfound) {
......@@ -83,6 +93,15 @@ while (1) {
next if $_->predict;
my $text = $_->read;
for my $line (split(/\r?\n/,$text)) {
if ($background_filter and $line=~/$background_filter/) {
print ".";
$background_printed = 1;
next;
}
else {
print "\n" if $background_printed;
$background_printed = 0;
}
my $l = process_line($_->{"input"}, $line);
print "$l\n" if $l;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment