* Option to show the tail of a log.

This commit is contained in:
Eelco Dolstra
2009-03-16 12:16:33 +00:00
parent 54475b9266
commit a6e84d8431
4 changed files with 17 additions and 4 deletions

View File

@ -65,7 +65,7 @@ sub showLog {
notFound($c, "Log file $path no longer exists.") unless -f $path;
if ($mode eq "") {
if (!$mode) {
# !!! quick hack
my $pipeline = ($path =~ /.bz2$/ ? "cat $path | bzip2 -d" : "cat $path")
. " | nix-log2xml | xsltproc " . $c->path_to("xsl/mark-errors.xsl") . " -"
@ -79,6 +79,11 @@ sub showLog {
$c->serve_static_file($path);
}
elsif ($mode eq "tail") {
$c->stash->{'plain'} = { data => scalar `tail -n 50 $path` };
$c->forward('Hydra::View::Plain');
}
else {
error($c, "Unknown log display mode `$mode'.");
}

View File

@ -0,0 +1,7 @@
package Hydra::View::Plain;
use strict;
use warnings;
use base 'Catalyst::View::Download::Plain';
1;