Log::Dispatch::Dir - Log messages to separate files in a directory, with rotate options


NAME

Log::Dispatch::Dir - Log messages to separate files in a directory, with rotate options


VERSION

version 0.03


SYNOPSIS

    use Log::Dispatch::Dir;
    my $dir = Log::Dispatch::Dir->new(
        name => 'dir1',
        min_level => 'info',
        dirname => 'somedir.log',
        filename_pattern => '%Y%m%d-%H%M%S.%{pid}.html',
    );
    $dir->log( level => 'info', message => 'your comment\n" );
    
    # limit total size
    my $dir = Log::Dispatch::Dir->new(
        # ...
        max_size => 10*1024*1024, # 10MB
    );
    # limit number of files
    my $dir = Log::Dispatch::Dir->new(
        # ...
        max_files => 1000,
    );
    # limit oldest file
    my $dir = Log::Dispatch::Dir->new(
        # ...
        max_age => 10*24*3600, # 10 days
    );


DESCRIPTION

This module provides a simple object for logging to directories under the Log::Dispatch::* system, and automatically rotating them according to different constraints. Each message will be logged to a separate file the directory.

Logging to separate files can be useful for example when dumping whole network responses (like HTTP::Response content).


METHODS

new(%p)

This method takes a hash of parameters. The following options are valid:

log_message(message => $)

Sends a message to the appropriate output. Generally this shouldn't be called directly but should be called through the log() method (in Log::Dispatch::Output).


SEE ALSO

the Log::Dispatch manpage


BUGS

Known bugs:

Please report any other bugs or feature requests to bug-log-dispatch-dir at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Log::Dispatch::Dir

You can also look for information at:


AUTHOR

  Steven Haryanto <stevenharyanto@gmail.com>


COPYRIGHT AND LICENSE

This software is copyright (c) 2010 by Steven Haryanto.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

 Log::Dispatch::Dir - Log messages to separate files in a directory, with rotate options