Update of /cvsroot/popfile/engine/POPFile
In directory sc8-pr-cvs1:/tmp/cvs-serv20671/POPFile
Modified Files:
Logger.pm
Log Message:
Add code to track last ten items placed in the top level log and a getter so that the UI can display them
Index: Logger.pm
===================================================================
RCS file: /cvsroot/popfile/engine/POPFile/Logger.pm,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** Logger.pm 30 Apr 2003 20:28:30 -0000 1.16
--- Logger.pm 9 Jun 2003 18:31:55 -0000 1.17
***************
*** 33,38 ****
--- 33,43 ----
# The name of the debug file
+
$self->{debug_filename__} = '';
+ # The last ten lines sent to the logger
+
+ $self->{last_ten__} = ();
+
bless($self, $class);
***************
*** 158,161 ****
--- 163,176 ----
print $msg if ( $self->global_config_( 'debug' ) & 2 );
+
+ # Add the line to the in memory collection of the last ten
+ # logger entries and then remove the first one if we now have
+ # more than 10
+
+ push @{$self->{last_ten__}}, ($msg);
+
+ if ( $#{$self->{last_ten__}} > 9 ) {
+ shift @{$self->{last_ten__}};
+ }
}
}
***************
*** 168,171 ****
--- 183,193 ----
return $self->{debug_filename__};
+ }
+
+ sub last_ten
+ {
+ my ( $self ) = @_;
+
+ return $self->{last_ten__};
}
|