Business-Shipping

 view release on metacpan or  search on metacpan

lib/Business/Shipping/Logging.pm  view on Meta::CPAN

package Business::Shipping::Logging;

=head1 NAME

Business::Shipping::Logging - Log4perl wrapper for easy, non-OO usage.

=head1 NOTES

The Log4perl category is Package::subroutine::line. This gives a lot of 
information for debugging. (Technically, category is whatever the fourth 
return value of caller(1) is.)

=head1 METHODS

=cut

use strict;
use warnings;
use base qw(Exporter);
use vars qw(@EXPORT $Current_Level);
use Carp;

lib/Business/Shipping/Logging.pm  view on Meta::CPAN

=head2 is_warn

=head2 is_info

=head2 is_debug

=head2 is_trace

=cut

# (caller(1))[3] is shorthand for my (undef, undef, undef, $sub) = caller(1);
# Using call frame depth of 1

sub logdie   { Log::Log4perl->get_logger((caller(1))[3])->logdie(@_); }
sub logwarn  { Log::Log4perl->get_logger((caller(1))[3])->logwarn(@_); }
sub fatal    { Log::Log4perl->get_logger((caller(1))[3])->fatal(@_); }
sub error    { Log::Log4perl->get_logger((caller(1))[3])->error(@_); }
sub warn     { Log::Log4perl->get_logger((caller(1))[3])->warn(@_); }
sub info     { Log::Log4perl->get_logger((caller(1))[3])->info(@_); }
sub debug    { Log::Log4perl->get_logger((caller(1))[3])->debug(@_); }
sub trace    { Log::Log4perl->get_logger((caller(1))[3])->trace(@_); }
sub is_fatal { Log::Log4perl->get_logger((caller(1))[3])->is_fatal(); }
sub is_error { Log::Log4perl->get_logger((caller(1))[3])->is_error(); }
sub is_warn  { Log::Log4perl->get_logger((caller(1))[3])->is_warn(); }
sub is_info  { Log::Log4perl->get_logger((caller(1))[3])->is_info(); }
sub is_debug { Log::Log4perl->get_logger((caller(1))[3])->is_debug(); }
sub is_trace { Log::Log4perl->get_logger((caller(1))[3])->is_trace(); }

=head2 log_level()

Does the heavy lifting for Business::Shipping->log_level().

=cut

sub log_level {
    my ($class, $log_level) = @_;
    return unless $log_level;



( run in 0.769 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )