[Bps-public-commit] r12288 - in Shipwright/trunk: lib

sunnavy at bestpractical.com sunnavy at bestpractical.com
Tue May 13 08:16:47 EDT 2008


Author: sunnavy
Date: Tue May 13 08:16:46 2008
New Revision: 12288

Modified:
   Shipwright/trunk/   (props changed)
   Shipwright/trunk/lib/Shipwright.pm

Log:
 r12301 at sunnavys-mb:  sunnavy | 2008-05-13 16:06:45 +0800
 default loggint to a file, which is named by the reposiotry


Modified: Shipwright/trunk/lib/Shipwright.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright.pm	(original)
+++ Shipwright/trunk/lib/Shipwright.pm	Tue May 13 08:16:46 2008
@@ -58,7 +58,21 @@
 
     my %args = @_;
 
-    my $self = { log_level => $args{log_level}, log_file => $args{log_file} };
+    my $log_file = $args{log_file};
+
+    unless ($log_file) {
+        # a better named log_file, in the name of reposiotry
+        require File::Spec;
+        my $info = join '', map { /\w/ ? $_ : '_' } split //, $args{repository};
+        $log_file =
+          File::Spec->catfile( File::Spec->tmpdir, "shipwright_${info}.log" );
+    }
+
+    my $self = {
+        log_level => $args{log_level},
+        log_file  => $log_file,
+    };
+    
     bless $self, $class;
 
     Shipwright::Logger->new($self);



More information about the Bps-public-commit mailing list