File Coverage

blib/lib/WebService/Mattermost/Role/Logger.pm
Criterion Covered Total %
statement 13 13 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 18 18 100.0


line stmt bran cond sub pod time code
1             package WebService::Mattermost::Role::Logger;
2:

3: # ABSTRACT: Internal logger role. 4:
5: use Moo::Role;
6: use Types::Standard 'InstanceOf';
7:
8: use WebService::Mattermost::Util::Logger;
9: use WebService::Mattermost::Helper::Alias 'util';
10:
11: ################################################################################
12:
13: has logger => (is => 'ro', isa => InstanceOf['Mojo::Log'], lazy => 1, builder => 1);
14:
15: ################################################################################
16:
17: sub _build_logger {
18: return util('Logger')->new->logger;
19: }
20:
21: ################################################################################
22:
23: 1;
24:
25: __END__
26:
27: =pod
28:
29: =encoding UTF-8
30:
31: =head1 NAME
32:
33: WebService::Mattermost::Role::Logger - Internal logger role.
34:
35: =head1 VERSION
36:
37: version 0.28
38:
39: =head1 DESCRIPTION
40:
41: Bundle a C<Mojo::Log> object into a Moo class.
42:
43: =head2 SYNOPSIS
44:
45: use Moo;
46:
47: with 'WebService::Mattermost::Role::Logger';
48:
49: sub something {
50: my $self = shift;
51:
52: $self->logger->warn('Foo');
53: }
54:
55: =head2 ATTRIBUTES
56:
57: =over 4
58:
59: =item C<logger>
60:
61: A C<Mojo::Log> object.
62:
63: =back
64:
65: =head1 SEE ALSO
66:
67: =over 4
68:
69: =item L<WebService::Mattermost::Util::Logger>
70:
71: =item C<Log::Log4perl>
72:
73: =back
74:
75: =head1 AUTHOR
76:
77: Mike Jones <mike@netsplit.org.uk>
78:
79: =head1 COPYRIGHT AND LICENSE
80:
81: This software is Copyright (c) 2020 by Mike Jones.
82:
83: This is free software, licensed under:
84:
85: The MIT (X11) License
86:
87: =cut
88: