File Coverage

blib/lib/PkgForge/BuildLog.pm
Criterion Covered Total %
statement 21 21 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod n/a
total 28 28 100.0


line stmt bran cond sub pod time code
1             package PkgForge::BuildLog; # -*-perl-*-
2 1     1   2673 use strict;
  1         3  
  1         45  
3 1     1   7 use warnings;
  1         3  
  1         61  
4              
5             # $Id: BuildLog.pm.in 16584 2011-04-05 10:09:34Z squinney@INF.ED.AC.UK $
6             # $Source:$
7             # $Revision: 16584 $
8             # $HeadURL: https://svn.lcfg.org/svn/source/tags/PkgForge-Server/PkgForge_Server_1_1_10/lib/PkgForge/BuildLog.pm.in $
9             # $Date: 2011-04-05 11:09:34 +0100 (Tue, 05 Apr 2011) $
10              
11             our $VERSION = '1.1.10';
12              
13 1     1   7 use English qw(-no_match_vars);
  1         3  
  1         10  
14 1     1   580 use File::Spec ();
  1         3  
  1         26  
15              
16 1     1   6 use Moose;
  1         2  
  1         10  
17 1     1   7937 use MooseX::Types::Moose qw(Bool Str);
  1         3  
  1         13  
18              
19             with 'MooseX::LogDispatch';
20              
21             has 'debug' => (
22             is => 'rw',
23             isa => Bool,
24             default => 0,
25             documentation => 'Controls whether or not to log debugging messages'
26             );
27              
28             has 'logfile' => (
29             is => 'ro',
30             isa => Str,
31             required => 1,
32             lazy => 1,
33             default => sub {
34             my $self = shift @_;
35             my $logfile = File::Spec->catfile( $self->logdir,
36             'pkgforge-build.log' );
37             },
38             documentation => 'The PkgForge build log file',
39             );
40              
41             has 'logdir' => (
42             is => 'ro',
43             isa => Str,
44             required => 1,
45             default => '.',
46             documentation => 'Where the pkgforge build log will be stored'
47             );
48              
49             has 'log_dispatch_conf' => (
50             is => 'ro',
51             isa => 'HashRef',
52             lazy => 1,
53             required => 1,
54             default => sub {
55             my $self = shift;
56              
57             return {
58             class => 'Log::Dispatch::File',
59             min_level => ( $self->debug ? 'debug' : 'info' ),
60             filename => $self->logfile,
61             mode => 'append',
62             format => '[%d] [%p] %m%n',
63             close_on_write => 1,
64             };
65             },
66             documentation => 'The configuration for Log::Dispatch',
67             );
68              
69 1     1   6875 no Moose;
  1         3  
  1         9  
70             __PACKAGE__->meta->make_immutable;
71              
72             1;
73             __END__