File Coverage

blib/lib/Log/Fine/Formatter/Detailed.pm
Criterion Covered Total %
statement 38 38 100.0
branch 5 6 83.3
condition 4 7 57.1
subroutine 10 10 100.0
pod 1 1 100.0
total 58 62 93.5


line stmt bran cond sub pod time code
1              
2             =head1 NAME
3              
4             Log::Fine::Formatter::Detailed - Formatter for detailed logging
5              
6             =head1 SYNOPSIS
7              
8             Formats log messages for output in a detailed format.
9              
10             use Log::Fine::Formatter::Detailed;
11             use Log::Fine::Handle::Console;
12              
13             # Instantiate a handle
14             my $handle = Log::Fine::Handle::Console->new();
15              
16             # Instantiate a formatter
17             my $formatter = Log::Fine::Formatter::Detailed
18             ->new( name => 'detail0',
19             timestamp_format => "%y-%m-%d %h:%m:%s" );
20              
21             # Set the formatter
22             $handle->formatter( formatter => $formatter );
23              
24             # Format a msg
25             my $str = $formatter->format(INFO, "Resistence is futile", 1);
26              
27             =head1 DESCRIPTION
28              
29             The detailed formatter logs messages in two different formats,
30             depending on where the log message came from.
31              
32             If the log message came from a particular class (e.g. C)
33             the detailed formatter will format as follows:
34              
35             [TIMESTAMP] (::Method():)
36              
37             Otherwise, the formatter will return a slightly more basic format:
38              
39             [TIMESTAMP] (