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 $fcb = $DXLog::log;
31 my @date = Julian::unixtojm(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 if \$count >= \$to; # stop after n
58 $fcb->close; # close any open files
60 my $fh = $fcb->open(@date);
61 for ($count = 0; $count < $to; ) {
67 $ref = [ split '\^' ];
68 push @{$ref}, "" unless @{$ref} >= 4;
71 eval $eval; # do the search on this file
72 last if $count >= $to; # stop after n
73 return ("Log search error", $@) if $@;
75 $fh = $fcb->openprev(); # get the next file
83 # the standard log printing interpreting routine.
85 # every line that is printed should call this routine to be actually visualised
87 # Don't really know whether this is the correct place to put this stuff, but where
90 # I get a reference to an array of items
96 my $d = atime($ref[0]);
99 if ($ref[1] eq 'rcmd') {
100 if ($ref[2] eq 'in') {
101 $s = "$ref[4] (priv: $ref[3]) rcmd: $ref[5]";
103 $s = "$ref[3] reply: $ref[4]";
105 } elsif ($ref[1] eq 'talk') {
106 $s = "$ref[3] -> $ref[2] ($ref[4]) $ref[5]";
107 } elsif ($ref[1] eq 'ann') {
108 $s = "$ref[3] -> $ref[2] $ref[4]";