No description or website provided.
Perl
Pull request Compare This branch is 28 commits behind tokuhirom:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib/File
t
xt
.gitignore
.shipit
Changes
MANIFEST
MANIFEST.SKIP
Makefile.PL
README.mkdn

README.mkdn

NAME

File::Stamped - time stamped log file

SYNOPSIS

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

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

DESCRIPTION

File::Stamped is utility for time stamped log file.

METHODS

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

This method creates new instance of File::Stamped. The arguments are followings.

- pattern : Str

This is file name pattern. It is the pattern for filename. The format is POSIX::strftime(), see also [POSIX](http://search.cpan.org/perldoc?POSIX).

- close_after_write : Bool

Default value is 1.

- iomode: Str

This is IO mode for opening file.

Default value is '>>:utf8'.

- autoflush: Bool

This attribute changes $|.
  • $fh->print($str: Str)

This method prints the $str to the file.

AUTHOR

Tokuhiro Matsuno

SEE ALSO

Log::Dispatch::File::Stamped

LICENSE

Copyright (C) Tokuhiro Matsuno

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