NAME

Log::LogMethods::Log4perlLogToString - Easy way to validate Logging to Log4Perl

SYNOPSIS

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;

DESCRIPTION

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..

Exports

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.

AUTHOR

Mike Shipper <AKALINUX@CPAN.ORG>