Apache2-Tail
view release on metacpan or search on metacpan
lib/Apache2/Tail.pm view on Meta::CPAN
$class->print_footer($r);
return Apache2::Const::OK;
}
sub style {
my ($class, $r) = @_;
if (my $user_style = $r->dir_config($class . '::CSS')) {
return qq(<link rel="stylesheet" type="text/css" href="$user_style">);
}
else {
return <<'EOF';
<style type="text/css">
body {
font-family: 'Courier New', courier, monospace;
font-size: 8pt;
line-height: 10pt;
color: #333333;
}
td {
padding: .25em;
align: top;
background-color: #eee;
}
td.timestamp {
font-size: 8pt;
text-align: center;
width: 130px;
}
tr.warn td {
background-color: #FFE79F;
}
tr.error td {
background-color: #FFCCCC;
}
tr.notice td {
background-color: #DFE7FF;
}
.vhost {
font-style: italic;
}
.loglevel {
text-align: center;
}
tr.info td.loglevel {
}
tr.notice td.loglevel {
color: #00C;
font-weight: bold;
}
tr.debug td.loglevel{
}
tr.warn td.loglevel {
font-weight: bold;
color: #FF803E;
}
tr.error td.loglevel {
color: #F00;
font-weight: bold;
}
.client {
color: #333333;
}
.message {
padding-left: .5em;
}
tr.error td.message, tr.warn td.message, tr.notice td.message {
font-weight: bold;
}
</style>
EOF
}
}
sub print_footer {
my ($class, $r) = @_;
$r->print(<<'EOF');
</table></body></html>
EOF
}
sub print_header {
my ($class, $r) = @_;
my $style = $class->style($r);
$r->print(<<"EOF");
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Apache2::Tail $VERSION</title>
$style
</head>
<body>
<table border=0>
EOF
}
sub tail_cnt {
my ($class, $r) = @_;
return $r->dir_config($class . '::Count') || TAIL_CNT();
}
sub error_log {
my ($class, $r) = @_;
my $s = $r->server;
return $r->dir_config($class . '::ErrorLog')
|| Apache2::ServerUtil::server_root_relative($r->pool,
$s->error_fname);
}
42;
__END__
=head1 NAME
Apache2::Tail - mod_perl handler to display the error_log
=head1 SYNOPSIS
PerlModule Apache2::Tail
<Location /tail>
SetHandler modperl
PerlHandler Apache2::Tail
( run in 0.594 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )