NAME

File::Stamped::Extended - generate date/time/PID/extra-string stamped FH for log file

SYNOPSIS

use File::Stamped::Extended;
my $fh = File::Stamped::Extended->new(pattern => '/var/log/myapp.log.!!.$$.%Y%m%d');
$fh->print("OK\n");

# with Log::Minimal
use Log::Minimal;
my $fh = File::Stamped::Extended->new(pattern => '/var/log/myapp.log.!!.$$.%Y%m%d');
local $Log::Minimal::PRINT = sub {
    my ( $time, $type, $message, $trace) = @_;
    $fh->extra($type);
    print {$fh} "$time [$type] $message at $trace\n";
};

DESCRIPTION

File::Stamped::Extended is extended FH generater based on File::Stamped.

In addition to the format provided by File::Stamped this module also supports '$' for inserting the PID and '!' for inserting extra-string.

METHODS

my $fh = File::Stamped::Extended->new(%args);

This method creates new instance of File::Stamped::Extended. The arguments are same as File::Stamped. Especially, an `extra` option exists only for File::Stamped::Extended.

extra : Str : default ''

extra value replace `!` in the pattern of stamp.

See File::Stamped for other options about new method.

my $fh->extra('warn');

set an `extra` string for inserting the pattern.

NOTE that $fh is closed when you call `extra` method.

REPOSITORY

File::Stamped::Extended is hosted on github <http://github.com/bayashi/File-Stamped-Extended>

AUTHOR

Dai Okabayashi <bayashi@cpan.org>

SEE ALSO

File::Stamped

LICENSE

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.