2 # Log Printing routines
4 # Copyright (c) - 1998 Dirk Koopman G1TLH
22 # print some items from the log backwards in time
24 # This command outputs a list of n lines starting from time t with $pattern tags
28 my $self = $DXLog::log;
31 my @date = $self->unixtoj(shift);
40 $search = '1' unless $pattern || $who;
41 $search = "\$ref->[1] =~ /$pattern/" if $pattern;
42 $search .= ' && ' if $pattern && $who;
43 $search .= "(\$ref->[2] =~ /$who/ || \$ref->[3] =~ /$who/)" if $who;
47 for (\$c = \$#in; \$c >= 0; \$c--) {
51 next if \$count < $from;
52 push \@out, print_item(\$ref);
53 last LOOP if \$count >= \$to; # stop after n
58 $self->close; # close any open files
60 my $fh = $self->open(@date);
62 while ($count < $to) {
67 push @in, [ split '\^' ];
69 eval $eval; # do the search on this file
70 return ("Spot search error", $@) if $@;
72 $fh = $self->openprev(); # get the next file
80 # the standard log printing interpreting routine.
82 # every line that is printed should call this routine to be actually visualised
84 # Don't really know whether this is the correct place to put this stuff, but where
87 # I get a reference to an array of items
93 my $d = atime($ref[0]);
96 if ($ref[1] eq 'rcmd') {
97 if ($ref[2] eq 'in') {
98 $s = "$ref[4] (priv: $ref[3]) rcmd: $ref[5]";
100 $s = "$ref[3] reply: $ref[4]";
102 } elsif ($ref[1] eq 'talk') {
103 $s = "$ref[3] -> $ref[2] ($ref[4]) $ref[5]";
104 } elsif ($ref[1] eq 'ann') {
105 $s = "$ref[3] -> $ref[2] $ref[4]";