AppRole/LogContextualWarn.pm

filter: Statementstmt 60.0% 12 / 20 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 42.8% 3 / 7 Podpod n/a totaltotal 55.5% 15 / 27 CC 1 SCAR 4.5
CC
1
Cov
60%
__ANON__
2.0
__ANON__
2.0
__ANON__
2.0
CRAP 1.6
« AppRole/LogContextual.pm ↑ Summary LogContextual.pm »
1 package Dancer2::Plugin::AppRole::LogContextualWarn;
2  
3 1 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use Log::Contextual ':log';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 our $VERSION = '1.152121'; # VERSION
10  
11 # ABSTRACT: role to force all warns in a Dancer2 plack app to log_warn
12  
13 #
14 # This file is part of Dancer2-Plugin-LogContextual
15 #
16 #
17 # Christian Walde has dedicated the work to the Commons by waiving all of his
18 # or her rights to the work worldwide under copyright law and all related or
19 # neighboring legal rights he or she had in the work, to the extent allowable by
20 # law.
21 #
22 # Works under CC0 do not require attribution. When citing the work, you should
23 # not imply endorsement by the author.
24 #
25  
26 0 ▶around to_app => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
27 0 my ( $attr, $self, @args ) = @_;
28 0 my $app = $self->$attr( @args );
29 0 ▶ return sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
30 0 ▶ local $SIG{__WARN__} = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
31 0 my @args = @_;
32 0 ▶ log_warn { @args };
Subroutine __ANON__: not called CC=1 SCAR=6.9
33 0 };
34 0 return $app->( @_ );
35 0 };
36 1 };
37  
38 1 1;
39  
40 __END__
« AppRole/LogContextual.pm ↑ Summary LogContextual.pm »