* Option to show the tail of a log.
This commit is contained in:
@ -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'.");
|
||||
}
|
||||
|
7
src/lib/Hydra/View/Plain.pm
Normal file
7
src/lib/Hydra/View/Plain.pm
Normal file
@ -0,0 +1,7 @@
|
||||
package Hydra::View::Plain;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use base 'Catalyst::View::Download::Plain';
|
||||
|
||||
1;
|
Reference in New Issue
Block a user