| 1 | package Dancer2::Plugin::AppRole::LogContextual; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use strictures 2; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use Log::Contextual 'with_logger'; | ||||||||
|
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 wrap a Dancer2 plack app in the configured Log::Contextual logger | ||||||||||
| 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=2 SCAR=17.9
| |||||||||||
| 30 | 0 | my @app_args = @_; | |||||||||
| 31 | 0 | my $logger = $self->setting( "lc_logger" ); | |||||||||
| 32 | return $logger | ||||||||||
| 33 | 0 | ▶ | ? with_logger $logger => sub { $app->( @app_args ) } | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 34 | 0 | ▶ | : $app->( @app_args ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | 0 | }; | |||||||||
| 36 | 1 | }; | |||||||||
| 37 | |||||||||||
| 38 | 1 | 1; | |||||||||
| 39 | |||||||||||
| 40 | __END__ | ||||||||||