blib/lib/Thunderhorse/Module/Logger.pm

filter: Statementstmt 100% 26 / 26 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 100% 1 / 1 totaltotal 100% 36 / 36 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Thunderhorse/Module.pm ↑ Summary
1 package Thunderhorse::Module::Logger;
2 4 $Thunderhorse::Module::Logger::VERSION = '0.107';
3 4 ▶use v5.40;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use Mooish::Base -standard;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use Gears::X::Thunderhorse;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use Gears::Logger::Handler;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 4 ▶use Future::AsyncAwait;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 4 extends 'Thunderhorse::Module';
12  
13 4 has field 'logger' => (
14 isa => InstanceOf ['Gears::Logger'],
15 lazy => 1,
16 );
17  
18 4 ▶sub _build_logger ($self)
Subroutine _build_logger: called CC=1 SCAR=0.0
19 {
20 4 my $config = $self->config;
21  
22 4 return Gears::Logger::Handler->new($config->%*);
23 }
24  
25 4 ▶sub build ($self)
Subroutine build: called CC=1 SCAR=0.0
Pod documented
26 {
27 4 weaken $self;
28 4 my $logger = $self->logger;
29  
30 $self->add_method(
31 3 ▶ controller => log => sub ($controller, $level, @messages) {
Subroutine __ANON__: called CC=1 SCAR=0.0
32 3 $logger->message($level, @messages);
33 3 return $controller;
34 }
35 4 );
36  
37 $self->add_hook(
38 1 ▶ error => sub ($controller, $ctx, $error) {
Subroutine __ANON__: called CC=1 SCAR=0.0
39 1 $logger->message(error => $error);
40 }
41 4 );
42 }
43  
44 __END__
« blib/lib/Thunderhorse/Module.pm ↑ Summary