Apache2-Tail

 view release on metacpan or  search on metacpan

lib/Apache2/Tail.pm  view on Meta::CPAN

    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

    [PerlSetVar Apache2::Tail::ErrorLog /some/other/log/file]
    [PerlSetVar Apache2::Tail::CSS /css/mystyle.css]
    [PerlSetVar Apache2::Tail::Count 100]

    Order deny,allow
    allow from 127.0.0.0/8
    deny from all
  </Location>


=head1 DESCRIPTION

Simple mod_perl handler that displays a pretty html version of the error_log.

=head2 OPTIONS

These options can be configured with PerlSetVar

=over 2

=item * Apache2::Tail::ErrorLog



( run in 1.749 second using v1.01-cache-2.11-cpan-39bf76dae61 )