| 1 | package Helm::Log; | ||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Moose::Util::TypeConstraints qw(enum); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | enum LOG_LEVEL => qw(debug info warn error); | |||||||||||||||||||||||||||
| 9 | has channels => ( | ||||||||||||||||||||||||||||
| 10 | is => 'ro', | ||||||||||||||||||||||||||||
| 11 | writer => '_channels', | ||||||||||||||||||||||||||||
| 12 | isa => 'ArrayRef[Helm::Log::Channel]', | ||||||||||||||||||||||||||||
| 13 | 0 | ▶ | default => sub { [] }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 14 | 1 | ); | |||||||||||||||||||||||||||
| 15 | 1 | has log_level => ( | |||||||||||||||||||||||||||
| 16 | is => 'ro', | ||||||||||||||||||||||||||||
| 17 | writer => '_log_level', | ||||||||||||||||||||||||||||
| 18 | isa => 'LOG_LEVEL', | ||||||||||||||||||||||||||||
| 19 | default => 'info', | ||||||||||||||||||||||||||||
| 20 | ); | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 0 | ▶ | sub add_channel { | ||||||||||||||||||||||||||
|
Subroutine
add_channel: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 23 | 0 | my ($self, $channel) = @_; | |||||||||||||||||||||||||||
| 24 | 0 | push(@{$self->channels}, $channel); | |||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 0 | ▶ | sub initialize { | ||||||||||||||||||||||||||
|
Subroutine
initialize: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 28 | 0 | my ($self, $helm) = @_; | |||||||||||||||||||||||||||
| 29 | 0 | $_->initialize($helm) foreach @{$self->channels}; | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 0 | ▶ | sub finalize { | ||||||||||||||||||||||||||
|
Subroutine
finalize: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 33 | 0 | my ($self, $helm) = @_; | |||||||||||||||||||||||||||
| 34 | 0 | $_->finalize($helm) foreach @{$self->channels}; | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 0 | ▶ | sub parallelize { | ||||||||||||||||||||||||||
|
Subroutine
parallelize: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 38 | 0 | my ($self, $helm) = @_; | |||||||||||||||||||||||||||
| 39 | 0 | $_->parallelize($helm) foreach @{$self->channels}; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 0 | ▶ | sub start_server { | ||||||||||||||||||||||||||
|
Subroutine
start_server: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 43 | 0 | my ($self, $server, $task) = @_; | |||||||||||||||||||||||||||
| 44 | 0 | $_->start_server($server, $task) foreach @{$self->channels}; | |||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 0 | ▶ | sub end_server { | ||||||||||||||||||||||||||
|
Subroutine
end_server: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 48 | 0 | my ($self, $server, $task) = @_; | |||||||||||||||||||||||||||
| 49 | 0 | $_->end_server($server, $task) foreach @{$self->channels}; | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 0 | ▶ | sub forked { | ||||||||||||||||||||||||||
|
Subroutine
forked: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 53 | 0 | my ($self, $type) = @_; | |||||||||||||||||||||||||||
| 54 | 0 | $_->forked($type) foreach @{$self->channels}; | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 0 | ▶ | sub debug { | ||||||||||||||||||||||||||
|
Subroutine
debug: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 58 | 0 | my ($self, $msg) = @_; | |||||||||||||||||||||||||||
| 59 | 0 | ▶ | if( $self->log_level eq 'debug' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | 0 | $_->debug($msg) foreach @{$self->channels}; | |||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 0 | ▶ | sub info { | ||||||||||||||||||||||||||
|
Subroutine
info: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 65 | 0 | my ($self, $msg) = @_; | |||||||||||||||||||||||||||
| 66 | 0 | ▶ | if($self->log_level eq 'debug' || $self->log_level eq 'info') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->log_level eq "debug" or $self->log_level eq "info"
MC/DC0%0/2
$self->log_level eq "debug" or $self->log_level eq "info"
$self->log_level eq "debug"
$self->log_level eq "info"
Truth table0%0/3
A or B
A= $self->log_level eq "debug"B= $self->log_level eq "info"
| |||||||||||||||||||||||||||||
| 67 | 0 | $_->info($msg) foreach @{$self->channels}; | |||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 0 | ▶ | sub warn { | ||||||||||||||||||||||||||
|
Subroutine
warn: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 72 | 0 | my ($self, $msg) = @_; | |||||||||||||||||||||||||||
| 73 | 0 | my @channels = @{$self->channels}; | |||||||||||||||||||||||||||
| 74 | 0 | ▶ | if( @channels ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 75 | 0 | $_->warn($msg) foreach @channels; | |||||||||||||||||||||||||||
| 76 | } else { | ||||||||||||||||||||||||||||
| 77 | # make sure something happens even if we don't have any channels. | ||||||||||||||||||||||||||||
| 78 | 0 | warn("Warning: $msg"); | |||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 0 | ▶ | sub error { | ||||||||||||||||||||||||||
|
Subroutine
error: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 83 | 0 | my ($self, $msg) = @_; | |||||||||||||||||||||||||||
| 84 | 0 | my @channels = @{$self->channels}; | |||||||||||||||||||||||||||
| 85 | 0 | ▶ | if( @channels ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 86 | 0 | $_->error($msg) foreach @channels; | |||||||||||||||||||||||||||
| 87 | } else { | ||||||||||||||||||||||||||||
| 88 | # make sure something happens even if we don't have any channels. | ||||||||||||||||||||||||||||
| 89 | 0 | die("Error: $msg"); | |||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 1 | 1; | |||||||||||||||||||||||||||