| 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
| |||||||||||
| 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
| |||||||||||
| 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
| |||||||||||
| 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__ | ||||||||||