Elasticsearch/Logger/LogAny.pm

filter: Statementstmt 96.6% 29 / 30 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 95.4% 42 / 44 CC 4 SCAR 4.5
CC
4
Cov
94%
_build_deprecate_handle
2.1
_build_log_handle
2.0
_build_trace_handle
2.0
CRAP 1.6
« Elasticsearch/Transport.pm ↑ Summary Elasticsearch/Role/Client.pm »
1 # Licensed to Elasticsearch B.V. under one or more contributor
2 # license agreements. See the NOTICE file distributed with
3 # this work for additional information regarding copyright
4 # ownership. Elasticsearch B.V. licenses this file to you under
5 # the Apache License, Version 2.0 (the "License"); you may
6 # not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing,
12 # software distributed under the License is distributed on an
13 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 # KIND, either express or implied. See the License for the
15 # specific language governing permissions and limitations
16 # under the License.
17  
18 package Search::Elasticsearch::Logger::LogAny;
19 55 $Search::Elasticsearch::Logger::LogAny::VERSION = '8.12';
20 55 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 55 with 'Search::Elasticsearch::Role::Logger';
22 55 ▶use Search::Elasticsearch::Util qw(parse_params to_list);
Subroutine BEGIN: called CC=1 SCAR=0.0
23 55 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 55 ▶use Log::Any 1.02 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
26 55 ▶use Log::Any::Adapter();
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 #===================================
29 99 ▶sub _build_log_handle {
Subroutine _build_log_handle: called CC=2 SCAR=6.9
30 #===================================
31 99 my $self = shift;
32 99 ▶ if ( my @args = to_list( $self->log_to ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@args) = to_list($self->log_to)) 3 96 99
33 3 Log::Any::Adapter->set( { category => $self->log_as }, @args );
34 }
35 99 Log::Any->get_logger( category => $self->log_as );
36 }
37  
38 #===================================
39 42 ▶sub _build_trace_handle {
Subroutine _build_trace_handle: called CC=2 SCAR=6.9
40 #===================================
41 42 my $self = shift;
42 42 ▶ if ( my @args = to_list( $self->trace_to ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@args) = to_list($self->trace_to)) 3 39 42
43 3 Log::Any::Adapter->set( { category => $self->trace_as }, @args );
44 }
45 42 Log::Any->get_logger( category => $self->trace_as );
46 }
47  
48 #===================================
49 1 ▶sub _build_deprecate_handle {
Subroutine _build_deprecate_handle: called CC=2 SCAR=7.6
50 #===================================
51 1 my $self = shift;
52 1 ▶ if ( my @args = to_list( $self->deprecate_to ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@args) = to_list($self->deprecate_to)) 0 1 1
53 0 Log::Any::Adapter->set( { category => $self->deprecate_as }, @args );
54 }
55 Log::Any->get_logger(
56 1 default_adapter => 'Stderr',
57 category => $self->deprecate_as
58 );
59 }
60  
61 55 1;
62  
63 # ABSTRACT: A Log::Any-based Logger implementation
64  
65 __END__
« Elasticsearch/Transport.pm ↑ Summary Elasticsearch/Role/Client.pm »