2 # Log Printing routines
4 # Copyright (c) - 1998 Dirk Koopman G1TLH
21 # print some items from the log backwards in time
23 # This command outputs a list of n lines starting from time t with $pattern tags
27 my $fcb = $DXLog::log;
28 my $from = shift || 0;
31 my $jdate = $fcb->unixtoj(shift);
38 my $tot = $from + $to;
42 $hint = "m{\\Q$pattern\\E}i";
48 $hint .= 'm{\\Q$who\\E}i';
50 $hint = "next unless $hint" if $hint;
58 shift \@in, if \@in > $tot;
62 $fcb->close; # close any open files
64 my $fh = $fcb->open($jdate);
65 L1: for ($count = 0; $count < $to; ) {
68 eval $eval; # do the search on this file
69 return ("Log search error", $@) if $@;
72 last L1 if $count >= $to;
73 my $ref = [ split /\^/, shift @in ];
74 next if defined $pattern && $ref->[1] ne $pattern;
75 push @tmp, print_item($ref);
80 $fh = $fcb->openprev(); # get the next file
88 # the standard log printing interpreting routine.
90 # every line that is printed should call this routine to be actually visualised
92 # Don't really know whether this is the correct place to put this stuff, but where
95 # I get a reference to an array of items
101 my $d = atime($ref[0]);
104 if ($ref[1] eq 'rcmd') {
105 if ($ref[2] eq 'in') {
106 $s = "$ref[4] (priv: $ref[3]) rcmd: $ref[5]";
108 $s = "$ref[3] reply: $ref[4]";
110 } elsif ($ref[1] eq 'talk') {
111 $s = "$ref[3] -> $ref[2] ($ref[4]) $ref[5]";
112 } elsif ($ref[1] eq 'ann') {
113 $s = "$ref[3] -> $ref[2] $ref[4]";