File Coverage

blib/lib/Dancer2/Plugin/LogReport/Message.pm
Criterion Covered Total %
statement 15 18 83.3
branch 2 6 33.3
condition n/a
subroutine 5 6 83.3
pod 2 2 100.0
total 24 32 75.0


line stmt bran cond sub pod time code
1             # This code is part of Perl distribution Dancer2-Plugin-LogReport version 2.02.
2             # The POD got stripped from this file by OODoc version 3.05.
3             # For contributors see file ChangeLog.
4              
5             # This software is copyright (c) 2015-2025 by Mark Overmeer.
6              
7             # This is free software; you can redistribute it and/or modify it under
8             # the same terms as the Perl 5 programming language system itself.
9             # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later
10              
11             #oodist: *** DO NOT USE THIS VERSION FOR PRODUCTION ***
12             #oodist: This file contains OODoc-style documentation which will get stripped
13             #oodist: during its release in the distribution. You can use this file for
14             #oodist: testing, however the code of this development version may be broken!
15              
16             package Dancer2::Plugin::LogReport::Message;{
17             our $VERSION = '2.02';
18             }
19              
20 2     2   4165 use base 'Log::Report::Message';
  2         4  
  2         366  
21              
22 2     2   16 use strict;
  2         4  
  2         80  
23 2     2   12 use warnings;
  2         3  
  2         156  
24              
25 2     2   17 use Log::Report 'dancer2-plugin-logreport';
  2         4  
  2         22  
26              
27             #--------------------
28              
29             sub reason
30 39     39 1 79 { my $self = shift;
31 39 100       157 $self->{reason} = $_[0] if exists $_[0];
32 39         203 $self->{reason};
33             }
34              
35             my %reason2color = (
36             TRACE => 'info',
37             ASSERT => 'info',
38             INFO => 'info',
39             NOTICE => 'info',
40             WARNING => 'warning',
41             MISTAKE => 'warning',
42             );
43              
44              
45             sub bootstrap_color
46 0     0 1   { my $self = shift;
47 0 0         return 'success' if $self->inClass('success');
48 0 0         $reason2color{$self->reason} || 'danger';
49             }
50              
51             1;