| 1 | package Message::Passing::Output::Log::Any::Adapter; | ||||||||||
| 2 | 3 | $Message::Passing::Output::Log::Any::Adapter::VERSION = '0.004'; | |||||||||
| 3 | # ABSTRACT: output messages via Log::Any::Adapter. | ||||||||||
| 4 | 3 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 3 | ▶ | use MooX::Types::MooseLike::Base qw( Str ArrayRef ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 3 | ▶ | use Log::Any qw( $log ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 3 | ▶ | use Log::Any::Adapter; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 3 | ▶ | use namespace::clean -except => 'meta'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | |||||||||||
| 11 | 3 | has adapter_name => ( | |||||||||
| 12 | is => 'ro', | ||||||||||
| 13 | isa => Str, | ||||||||||
| 14 | required => 1, | ||||||||||
| 15 | ); | ||||||||||
| 16 | |||||||||||
| 17 | 3 | has adapter_params => ( | |||||||||
| 18 | is => 'ro', | ||||||||||
| 19 | isa => ArrayRef, | ||||||||||
| 20 | ); | ||||||||||
| 21 | |||||||||||
| 22 | 2 | ▶ | sub BUILD { | ||||||||
|
Subroutine
BUILD: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 23 | 2 | my $self = shift; | |||||||||
| 24 | |||||||||||
| 25 | 2 | my @params = ( $self->adapter_name ); | |||||||||
| 26 | 2 | ▶ | push @params, @{ $self->adapter_params } | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | if defined $self->adapter_params; | ||||||||||
| 28 | |||||||||||
| 29 | 2 | Log::Any::Adapter->set(@params); | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | 2 | ▶ | sub consume { | ||||||||
|
Subroutine
consume: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 33 | 2 | my ( $self, $msg ) = @_; | |||||||||
| 34 | |||||||||||
| 35 | 2 | my $severity = 'info'; | |||||||||
| 36 | |||||||||||
| 37 | 2 | $log->$severity($msg); | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 3 | with 'Message::Passing::Role::Output'; | |||||||||
| 41 | |||||||||||
| 42 | 3 | 1; | |||||||||
| 43 | |||||||||||
| 44 | __END__ | ||||||||||