File Coverage

blib/lib/Sprocket/Logger/Basic.pm
Criterion Covered Total %
statement 10 17 58.8
branch 1 10 10.0
condition 1 5 20.0
subroutine 4 4 100.0
pod 1 2 50.0
total 17 38 44.7


line stmt bran cond sub pod time code
1             package Sprocket::Logger::Basic;
2              
3 5     5   28 use strict;
  5         9  
  5         174  
4 5     5   28 use warnings;
  5         9  
  5         1687  
5              
6             sub new {
7 10     10 0 26 my $class = shift;
8 10   33     122 bless( {}, ref $class || $class );
9             }
10              
11             sub put {
12 24     24 1 176 my ($self, $sprocket, $opts) = @_;
13              
14 24 50       151 return unless ( $opts->{v} <= $sprocket->{opts}->{log_level} );
15 0           my $con = $sprocket->{heap};
16 0 0         my $sender = ( $con )
    0          
17             ? ( $con->peer_addr ? $con->peer_addr : '' )."(".$con->ID.")" : "?";
18 0 0         my $l = $opts->{l} ? $opts->{l}+2 : 2;
19 0 0 0       my $caller = $opts->{call} ? $opts->{call} : ( caller($l) )[3] || '?';
20 0           $caller =~ s/^POE::Component/PoCo/o;
21 0           $caller =~ s/^Sprocket::Plugin/SPlugin/o;
22 0           print STDERR '['.localtime()."][pid:$$][$sprocket->{connections}][$caller][$sender] $opts->{msg}\n";
23             }
24              
25             1;
26              
27             __END__