Client/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
« Client/Transport.pm ↑ Summary Client/Role/Client.pm »
1 # OpenSearch::Client is an unofficial client for OpenSearch.
2 # It is derived from Search::Elasticsearch version 7.714
3 # License details from the original work are contained in the
4 # NOTICE file distributed with this work.
5 #
6 #-----------------------------------------------------------------------
7 # OpenSearch::Client
8 #-----------------------------------------------------------------------
9 # Copyright 2026 Mark Dootson
10 #
11 # Licensed under the Apache License, Version 2.0 (the "License");
12 # you may not use this file except in compliance with the License.
13 # You may obtain a copy of the License at
14 #
15 # http://www.apache.org/licenses/LICENSE-2.0
16 #
17 # Unless required by applicable law or agreed to in writing, software
18 # distributed under the License is distributed on an "AS IS" BASIS,
19 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 # See the License for the specific language governing permissions and
21 # limitations under the License.
22  
23 package OpenSearch::Client::Logger::LogAny;
24 56 $OpenSearch::Client::Logger::LogAny::VERSION = '3.007011';
25 56 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 56 with 'OpenSearch::Client::Role::Logger';
27 56 ▶use OpenSearch::Client::Util qw(parse_params to_list);
Subroutine BEGIN: called CC=1 SCAR=0.0
28 56 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
29  
30 56 ▶use Log::Any 1.708 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
31 56 ▶use Log::Any::Adapter();
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33 #===================================
34 99 ▶sub _build_log_handle {
Subroutine _build_log_handle: called CC=2 SCAR=6.9
35 #===================================
36 99 my $self = shift;
37 99 ▶ if ( my @args = to_list( $self->log_to ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@args) = to_list($self->log_to)) 3 96 99
38 3 Log::Any::Adapter->set( { category => $self->log_as }, @args );
39 }
40 99 Log::Any->get_logger( category => $self->log_as );
41 }
42  
43 #===================================
44 42 ▶sub _build_trace_handle {
Subroutine _build_trace_handle: called CC=2 SCAR=6.9
45 #===================================
46 42 my $self = shift;
47 42 ▶ if ( my @args = to_list( $self->trace_to ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@args) = to_list($self->trace_to)) 3 39 42
48 3 Log::Any::Adapter->set( { category => $self->trace_as }, @args );
49 }
50 42 Log::Any->get_logger( category => $self->trace_as );
51 }
52  
53 #===================================
54 1 ▶sub _build_deprecate_handle {
Subroutine _build_deprecate_handle: called CC=2 SCAR=7.6
55 #===================================
56 1 my $self = shift;
57 1 ▶ if ( my @args = to_list( $self->deprecate_to ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@args) = to_list($self->deprecate_to)) 0 1 1
58 0 Log::Any::Adapter->set( { category => $self->deprecate_as }, @args );
59 }
60 Log::Any->get_logger(
61 1 default_adapter => 'Stderr',
62 category => $self->deprecate_as
63 );
64 }
65  
66 56 1;
67  
68 __END__
« Client/Transport.pm ↑ Summary Client/Role/Client.pm »