[Bps-public-commit] r10805 - in Shipwright/lib: Shipwright Shipwright/Script
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Mon Feb 11 09:11:06 EST 2008
Author: sunnavy
Date: Mon Feb 11 09:10:59 2008
New Revision: 10805
Modified:
Shipwright/lib/Shipwright.pm
Shipwright/lib/Shipwright/Logger.pm
Shipwright/lib/Shipwright/Script/Build.pm
Shipwright/lib/Shipwright/Script/Import.pm
Shipwright/lib/Shipwright/Script/Initialize.pm
Shipwright/lib/Shipwright/Script/Maintain.pm
Shipwright/lib/Shipwright/Script/Update.pm
Log:
added log-file arg for cmd, also updated log layout
Modified: Shipwright/lib/Shipwright.pm
==============================================================================
--- Shipwright/lib/Shipwright.pm (original)
+++ Shipwright/lib/Shipwright.pm Mon Feb 11 09:10:59 2008
@@ -8,7 +8,7 @@
use base qw/Class::Accessor::Fast/;
-__PACKAGE__->mk_accessors(qw/backend source build log_level/);
+__PACKAGE__->mk_accessors(qw/backend source build log_level log_file/);
use Shipwright::Backend;
use Shipwright::Source;
@@ -25,7 +25,7 @@
my %args = @_;
- my $self = { log_level => $args{log_level} };
+ my $self = { log_level => $args{log_level}, log_file => $args{log_file} };
bless $self, $class;
Shipwright::Logger->new($self);
Modified: Shipwright/lib/Shipwright/Logger.pm
==============================================================================
--- Shipwright/lib/Shipwright/Logger.pm (original)
+++ Shipwright/lib/Shipwright/Logger.pm Mon Feb 11 09:10:59 2008
@@ -26,13 +26,32 @@
my $shipwright = shift;
my $log_level = uc $shipwright->log_level || 'INFO';
- my %default = (
- 'log4perl.rootLogger' => "$log_level,Screen",
- 'log4perl.appender.Screen' => 'Log::Log4perl::Appender::Screen',
- 'log4perl.appender.Screen.stderr' => 1,
- 'log4perl.appender.Screen.layout' =>
- 'Log::Log4perl::Layout::SimpleLayout'
- );
+ my %default;
+
+ if ( $shipwright->log_file ) {
+ %default = (
+ 'log4perl.rootLogger' => "$log_level,File",
+ 'log4perl.appender.File.filename' => $shipwright->log_file,
+ 'log4perl.appender.File' => 'Log::Log4perl::Appender::File',
+ 'log4perl.appender.File.stderr' => 1,
+ 'log4perl.appender.File.layout' =>
+ 'Log::Log4perl::Layout::PatternLayout',
+ 'log4perl.appender.File.layout.ConversionPattern' =>
+ '%d %p> %F{1}:%L %M - %m%n',
+ );
+ }
+ else {
+ %default = (
+ 'log4perl.rootLogger' => "$log_level,Screen",
+ 'log4perl.appender.Screen' => 'Log::Log4perl::Appender::Screen',
+ 'log4perl.appender.Screen.stderr' => 1,
+ 'log4perl.appender.Screen.layout' =>
+ 'Log::Log4perl::Layout::PatternLayout',
+ 'log4perl.appender.Screen.layout.ConversionPattern' =>
+ '%d %p> %F{1}:%L %M - %m%n',
+ );
+ }
+
Log::Log4perl->init( \%default );
}
Modified: Shipwright/lib/Shipwright/Script/Build.pm
==============================================================================
--- Shipwright/lib/Shipwright/Script/Build.pm (original)
+++ Shipwright/lib/Shipwright/Script/Build.pm Mon Feb 11 09:10:59 2008
@@ -6,7 +6,8 @@
use base qw/App::CLI::Command Class::Accessor::Fast Shipwright::Script/;
__PACKAGE__->mk_accessors(
- qw/repository log_level install_base build_base skip skip_test only_test force/
+ qw/repository log_level install_base build_base skip skip_test only_test
+ force log_file/
);
use Shipwright;
@@ -18,6 +19,7 @@
(
'r|repository=s' => 'repository',
'l|log-level=s' => 'log_level',
+ 'log-file=s' => 'log_file',
'install-base=s' => 'install_base',
'skip=s' => 'skip',
'skip-test' => 'skip_test',
@@ -41,6 +43,7 @@
my $shipwright = Shipwright->new(
repository => $self->repository,
log_level => $self->log_level,
+ log_file => $self->log_file,
build_skip => $self->skip,
);
$shipwright->backend->export( target => $shipwright->build->build_base );
Modified: Shipwright/lib/Shipwright/Script/Import.pm
==============================================================================
--- Shipwright/lib/Shipwright/Script/Import.pm (original)
+++ Shipwright/lib/Shipwright/Script/Import.pm Mon Feb 11 09:10:59 2008
@@ -7,7 +7,7 @@
use base qw/App::CLI::Command Class::Accessor::Fast Shipwright::Script/;
__PACKAGE__->mk_accessors(
qw/repository log_level comment source follow build_script require_yml
- name test_script extra_tests overwrite min_perl_version skip/
+ name test_script extra_tests overwrite min_perl_version skip log_file/
);
use Shipwright;
@@ -27,6 +27,7 @@
(
'r|repository=s' => 'repository',
'l|log-level=s' => 'log_level',
+ 'log-file=s' => 'log_file',
'm|comment=s' => 'comment',
's|source=s' => 'source',
'name=s' => 'name',
@@ -73,6 +74,7 @@
my $shipwright = Shipwright->new(
repository => $self->repository,
log_level => $self->log_level,
+ log_file => $self->log_file,
source => $self->source,
name => $self->name,
follow => $self->follow,
@@ -86,8 +88,10 @@
# skip already imported dists
$shipwright->source->skip(
- Hash::Merge::merge( $self->skip, $shipwright->backend->map ||
- {} ) );
+ Hash::Merge::merge(
+ $self->skip, $shipwright->backend->map || {}
+ )
+ );
}
Shipwright::Util::DumpFile(
@@ -146,7 +150,8 @@
Shipwright::Util::LoadFile( $shipwright->source->url_path )
|| {};
$shipwright->backend->source(
- Hash::Merge::merge( $shipwright->backend->source || {}, $new_url ) );
+ Hash::Merge::merge( $shipwright->backend->source || {}, $new_url )
+ );
}
# import tests
Modified: Shipwright/lib/Shipwright/Script/Initialize.pm
==============================================================================
--- Shipwright/lib/Shipwright/Script/Initialize.pm (original)
+++ Shipwright/lib/Shipwright/Script/Initialize.pm Mon Feb 11 09:10:59 2008
@@ -5,7 +5,7 @@
use Carp;
use base qw/App::CLI::Command Class::Accessor::Fast Shipwright::Script/;
-__PACKAGE__->mk_accessors(qw/repository log_level/);
+__PACKAGE__->mk_accessors(qw/repository log_level log_file/);
use Shipwright;
use File::Spec;
@@ -18,6 +18,7 @@
(
'r|repository=s' => 'repository',
'l|log-level=s' => 'log_level',
+ 'log-file=s' => 'log_file',
);
}
@@ -33,6 +34,7 @@
my $shipwright = Shipwright->new(
repository => $self->repository,
log_level => $self->log_level,
+ log_file => $self->log_file,
);
$shipwright->backend->initialize();
}
Modified: Shipwright/lib/Shipwright/Script/Maintain.pm
==============================================================================
--- Shipwright/lib/Shipwright/Script/Maintain.pm (original)
+++ Shipwright/lib/Shipwright/Script/Maintain.pm Mon Feb 11 09:10:59 2008
@@ -7,7 +7,7 @@
use base qw/App::CLI::Command Class::Accessor::Fast Shipwright::Script/;
__PACKAGE__->mk_accessors(
qw/repository log_level update_order keep_recommends
- keep_build_requires keep_requires for_dists/
+ keep_build_requires keep_requires for_dists log_file/
);
use Shipwright;
@@ -19,6 +19,7 @@
(
'r|repository=s' => 'repository',
'l|log-level=s' => 'log_level',
+ 'log-file=s' => 'log_file',
'update-order' => 'update_order',
'keep-recommends=s' => 'keep_recommends',
'keep-requires=s' => 'keep_requires',
@@ -38,6 +39,7 @@
my $shipwright = Shipwright->new(
repository => $self->repository,
log_level => $self->log_level,
+ log_file => $self->log_file,
);
if ( $self->update_order ) {
Modified: Shipwright/lib/Shipwright/Script/Update.pm
==============================================================================
--- Shipwright/lib/Shipwright/Script/Update.pm (original)
+++ Shipwright/lib/Shipwright/Script/Update.pm Mon Feb 11 09:10:59 2008
@@ -5,7 +5,7 @@
use Carp;
use base qw/App::CLI::Command Class::Accessor::Fast Shipwright::Script/;
-__PACKAGE__->mk_accessors(qw/repository log_level name all follow/);
+__PACKAGE__->mk_accessors(qw/repository log_level name all follow log_file/);
use Shipwright;
use File::Spec;
@@ -25,6 +25,7 @@
(
'r|repository=s' => 'repository',
'l|log-level=s' => 'log_level',
+ 'log-file=s' => 'log_file',
'name=s' => 'name',
'a|all' => 'all',
'follow' => 'follow',
@@ -51,6 +52,7 @@
$shipwright = Shipwright->new(
repository => $self->repository,
log_level => $self->log_level,
+ log_file => $self->log_file,
);
$map = $shipwright->backend->map || {};
More information about the Bps-public-commit
mailing list