Apache2-ModLogConfig

 view release on metacpan or  search on metacpan

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

package Apache2::ModLogConfig;

use 5.008008;
use strict;
use warnings;

{
    our $VERSION = '0.01';
    require XSLoader;
    XSLoader::load('Apache2::ModLogConfig', $VERSION);
}

1;
__END__

=encoding utf8

=head1 NAME

Apache2::ModLogConfig - a Perl interface to mod_log_config

=head1 SYNOPSIS

Call a Perl handler from a C<CustomLog> format specification:

 <Perl>
   use Apache2::ModLogConfig ();

   sub My::Format {
     my ($r)=@_;

     return $a_string;
   }
 </Perl>

 CustomLog LOGFILE "... %{My::Format}^..."

Use a Perl handler as logfile:

 PerlModule Apache2::ModLogConfig
 PerlModule My::LogReceiver

 CustomLog "@perl: My::LogReceiver" "format spec"

Print to a logfile:

 use Apache2::ModLogConfig ();

 sub handler {
   my ($r)=@_;
   ...
   my $log=$r->server->custom_log_by_name('logs/access_log');
   my $success=$log->print($r, qw/тут был вася/, "\n");
   ...
 }

=head1 DESCRIPTION

The reason to start this module was to monitor the number of incoming and
outgoing bytes for each request. C<mod_log_config> in combination with
C<mod_logio> can log these numbers. But in Perl they are really hard to get.

C<mod_logio> uses a network-level input filter as byte counter. The outgoing
bytes are counted by the core output filter and reported back to C<mod_logio>
if loaded.

Now, with the help of this module you can do 3 things:

=over 4

=item * call a Perl handler from a C<CustomLog> format specification

=item * use a Perl handler in place of a logfile

=item * write out-of-bound messages to logfiles managed by C<mod_log_config>



( run in 0.599 second using v1.01-cache-2.11-cpan-bbcb1afb8fc )