21 Feb 2017 04:00:59 UTC
- Distribution: Log-Dispatch-File-Stamped
- Module version: 0.19
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (2)
- Testers (649 / 0 / 0)
- KwaliteeBus factor: 1
- 96.10% Coverage
- License: perl_5
- Perl: v5.6.0
- Activity24 month
- Download (29.17KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:1 non-PAUSE userETHER Karen Etheridge 🐾 🌋🦑🇹🇼🇭🇰🇺🇦and 1 contributors
- SEE ALSO
- COPYRIGHT AND LICENCE
Log::Dispatch::File::Stamped - Logging to date/time stamped files
use Log::Dispatch::File::Stamped; my $file = Log::Dispatch::File::Stamped->new( name => 'file1', min_level => 'info', filename => 'Somefile.log', stamp_fmt => '%Y%m%d', time_function => 'localtime', mode => 'append', ); $file->log( level => 'emerg', message => "I've fallen and I can't get up\n" );
This module subclasses Log::Dispatch::File for logging to date/time-stamped files, respecting all its configuration options. As with other Log::Dispatch handlers, the destination file is kept open for as long as the filename remains constant (unless
This method takes the same set of parameters as Log::Dispatch::File::new(), with the following differences:
The filename template. The actual timestamp will be appended to this filename when creating the actual logfile. If the filename has an extension, the timestamp is inserted before the extension. See examples below.
The format of the timestamp string. This module uses POSIX::strftime to create the timestamp string from the current local date and time. Refer to your platform's
strftimedocumentation for the list of allowed tokens.
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).
Assuming the current date and time is:
% perl -e 'print scalar localtime' Sat Feb 8 13:56:13 2003 Log::Dispatch::File::Stamped->new( name => 'file', min_level => 'debug', filename => 'logfile.txt', );
This will log to file logfile-20030208.txt.
Log::Dispatch::File::Stamped->new( name => 'file', min_level => 'debug', filename => 'logfile.txt', stamp_fmt => '%d%H', );
This will log to file logfile-0813.txt.
Dave Rolsky, author of the Log::Dispatch suite and many other fine modules on CPAN.
This module was rewritten to respect all present (and future) options to Log::Dispatch::File by Karen Etheridge, <firstname.lastname@example.org>.
Eric Cholet <email@example.com>
Karen Etheridge <firstname.lastname@example.org>
This software is copyright (c) 2003 by Eric Cholet and Karen Etheridge.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Module Install Instructions
To install Log::Dispatch::File::Stamped, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Log::Dispatch::File::Stamped
For more information on module installation, please visit the detailed CPAN module installation guide.