| 1 | package PkgForge::BuildLog; # -*-perl-*- | ||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 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 | 1 | our $VERSION = '1.1.10'; | |||||||||
| 12 | |||||||||||
| 13 | 1 | ▶ | use English qw(-no_match_vars); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 1 | ▶ | use File::Spec (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 1 | ▶ | use MooseX::Types::Moose qw(Bool Str); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | |||||||||||
| 19 | 1 | with 'MooseX::LogDispatch'; | |||||||||
| 20 | |||||||||||
| 21 | 1 | 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 | 0 | ▶ | default => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 34 | 0 | my $self = shift @_; | |||||||||
| 35 | 0 | my $logfile = File::Spec->catfile( $self->logdir, | |||||||||
| 36 | 'pkgforge-build.log' ); | ||||||||||
| 37 | }, | ||||||||||
| 38 | 1 | documentation => 'The PkgForge build log file', | |||||||||
| 39 | ); | ||||||||||
| 40 | |||||||||||
| 41 | 1 | 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 | 0 | ▶ | default => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 55 | 0 | my $self = shift; | |||||||||
| 56 | |||||||||||
| 57 | return { | ||||||||||
| 58 | 0 | ▶ | class => 'Log::Dispatch::File', | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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 | 1 | documentation => 'The configuration for Log::Dispatch', | |||||||||
| 67 | ); | ||||||||||
| 68 | |||||||||||
| 69 | 1 | ▶ | no Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 70 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 71 | |||||||||||
| 72 | 1 | 1; | |||||||||
| 73 | __END__ | ||||||||||