Log::LogMethods::Log4perlLogToString - Easy way to validate Logging to Log4Perl
use Moder::Perl; use Log::LogMethods::Log4perlLogToString; my $string=''; my $class; my $string=''; my $log=LoggerToString($class,$string); $log->info("something to log"); print $string;
Created as a way to save time writting unit tests, Log::LogMethods::Log4perlLogToString does all the dirty work of creating a logger that writes to a string or File handle..
All functions and variables are exported by default, if you only want to import a single funciton, just provide the statement in the use list.
$DEFAULT_LAYOUT
The default Log::Log4perl::Layout::PatternLayout.
%H %P %d %p %k %S [%h] [%s] %b %j %B%n
my $log=LoggerToString($class,$string,$format);
$log is a loger object created for $class. If $format is empty then $DEFAULT_FORMAT is used.
my $log=LoggerToFh($class,$fh,$format);
Really the guts of this class, it creates a logger that writes to $fh.
Mike Shipper <AKALINUX@CPAN.ORG>
To install Log::LogMethods, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::LogMethods
CPAN shell
perl -MCPAN -e shell install Log::LogMethods
For more information on module installation, please visit the detailed CPAN module installation guide.