Log::Minimal::Instance - Instance based on Log::Minimal
use Log::Minimal::Instance; # log to file my $log = Log::Minimal::Instance->new( base_dir => 'log', pattern => 'myapp.log.%Y%m%d', # File::Stamped style ); # same as Log::Minimal method $log->debugf('debug'); $log->infof('info'); # ./log/myapp.log.20130101 2013-01-01T16:15:39 [DEBUG] debug at lib/MyApp.pm line 10 2013-01-01T16:15:39 [INFO] info at lib/MyApp.pm line 11 # log to stderr $log = Log::Minimal::Instance->new(); # specified $Log::Minimal::LOG_LEVEL $log = Log::Minimal::Instance->new( level => 'WARN', ); # original methods $log->infod(\%hash); $log->warnd(\@array); $log->log_to('finish.log.%Y%m%d', $message); # log to log/finish.log.20130101
Log::Minimal::Instance is used in Log::Minimal based module to create an instance.
See Log::Minimal
Create new instance of Log::Minimal::Instance based on Log::Minimal.
Attributes are following:
Set to $Log::Minimal::LOG_LEVEL
Base directory for log file
This is file name pattern that is same of L<File::Stamped>.
Generate symlink file for log file.
See L<File::Stamped>.
Default value is 1.
Default value is '>>:utf8'.
Default value is true.
Default value is false.
When expressed in code the above methods:
use Log::Minimal; infof( ddf(\%hash) );
# $pattern is File::Stamped style. $log->log_to('trace.log.%Y%m%d', 'traceroute'); # ./log/trace.log.20130101 2013-01-01T16:15:40 traceroute at lib/MyApp.pm line 13 # with symlink $log->log_to([ 'trace.log.%Y%m%d', 'trace.log' ], 'blah blah blah');
Kosuke Arisawa <arisawa {at} gmail.com>
Copyright 2013- Kosuke Arisawa
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Log::Minimal
File::Stamped
To install Log::Minimal::Instance, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::Minimal::Instance
CPAN shell
perl -MCPAN -e shell install Log::Minimal::Instance
For more information on module installation, please visit the detailed CPAN module installation guide.