File Coverage

blib/lib/Data/DTO/GELF/Types.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Data::DTO::GELF::Types;
2              
3             # ABSTRACT: Special types for log level conversion
4             our $VERSION = '1.6'; # VERSION 1.6
5             our $VERSION=1.6;
6 5         34 use MooseX::Types -declare => [
7             qw(
8             LogLevel
9              
10             )
11 5     5   2257 ];
  5         166151  
12              
13 5     5   25832 use MooseX::Types::Moose qw/Int Str/;
  5         87532  
  5         42  
14              
15 5     5   25494 use Readonly;
  5         14172  
  5         603  
16             Readonly my %LOGLEVEL_MAP => (
17             DEBUG => 0,
18             INFO => 1,
19             NOTICE => 2,
20             WARNING => 3,
21             ERROR => 4,
22             CRITICAL => 5,
23             ALERT => 6,
24             EMERGENCY => 8
25             );
26              
27             subtype LogLevel, as Int;
28              
29             coerce LogLevel, from Str, via { $LOGLEVEL_MAP{ uc $_ } // $_; };
30              
31             1;
32              
33             __END__
34              
35             =pod
36              
37             =encoding UTF-8
38              
39             =head1 NAME
40              
41             Data::DTO::GELF::Types - Special types for log level conversion
42              
43             =head1 VERSION
44              
45             version 1.6
46              
47             =head1 AUTHOR
48              
49             Brandon "Dimentox Travanti" Husbands <xotmid@gmail.com>
50              
51             =head1 COPYRIGHT AND LICENSE
52              
53             This software is copyright (c) 2017 by Brandon "Dimentox Travanti" Husbands.
54              
55             This is free software; you can redistribute it and/or modify it under
56             the same terms as the Perl 5 programming language system itself.
57              
58             =cut