blib/lib/Log/Any/Adapter/Catalyst.pm

filter: Statementstmt 100% 27 / 27 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 94.4% 34 / 36 CC 2 SCAR 2.7
CC
2
Cov
97%
init
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
↑ Summary
1 package Log::Any::Adapter::Catalyst;
2  
3 # ABSTRACT: Enable error and status logging in Catalyst Models via Log::Any
4  
5 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Log::Any::Adapter::Util qw(make_method);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use base qw(Log::Any::Adapter::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 our $VERSION = '1.00';
12  
13 1 ▶sub init {
Subroutine init: called CC=2 SCAR=7.2
Pod undocumented
14 1 my ($self) = @_;
15  
16 croak "Log::Any::Adapter->set must be called with the 'logger' parameter\n"
17 . "Typically, in you Catalyst Application Class:\n"
18 . "Log::Any::Adapter->set('Catalyst', logger => __PACKAGE__->log);\n"
19 1 ▶ unless $self->{logger};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"logger"} 0 1 1
20 }
21  
22 # Connect the Log::Any methods to the appropriate Catalyst::Log method
23 2 foreach my $method ( Log::Any->logging_and_detection_methods() ) {
24 36 my $cat_log_method = $method;
25  
26 # Map log levels down to Catalyst::Log levels where necessary
27 36 for ($cat_log_method) {
28 36 s/trace/debug/;
29 36 s/notice/info/;
30 36 s/warning/warn/;
31 36 s/critical|alert|emergency/fatal/;
32 }
33  
34 36 __PACKAGE__->delegate_method_to_slot( 'logger', $method, $cat_log_method );
35 }
36  
37 2 1;
38  
39 __END__
↑ Summary