make logging suck less
Arthur Axel 'fREW' Schmidt [Sat, 21 Jul 2012 05:02:49 +0000 (00:02 -0500)]
dist.ini
lib/DBIx/Class/DeploymentHandler/Dad.pm
lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm
lib/DBIx/Class/DeploymentHandler/LogImporter.pm [new file with mode: 0644]
lib/DBIx/Class/DeploymentHandler/VersionStorage/Deprecated.pm
lib/DBIx/Class/DeploymentHandler/VersionStorage/Standard.pm

index f9dda5d..03043ca 100644 (file)
--- a/dist.ini
+++ b/dist.ini
@@ -25,7 +25,7 @@ repository.type   = git
 parent                      = 0.225
 autodie                     = 0
 namespace::autoclean        = 0
-Log::Contextual             = 0.00300
+Log::Contextual             = 0.004200
 File::Path                  = 2.08
 DBIx::Class                 = 0.08121
 Moose                       = 1.0
index f06336f..4b3c7fc 100644 (file)
@@ -5,12 +5,8 @@ package DBIx::Class::DeploymentHandler::Dad;
 use Moose;
 require DBIx::Class::Schema;    # loaded for type constraint
 use Carp::Clan '^DBIx::Class::DeploymentHandler';
-use DBIx::Class::DeploymentHandler::Logger;
+use DBIx::Class::DeploymentHandler::LogImporter ':log';
 use DBIx::Class::DeploymentHandler::Types;
-use Log::Contextual ':log', -package_logger =>
-  DBIx::Class::DeploymentHandler::Logger->new({
-    env_prefix => 'DBICDH'
-  });
 
 has schema => (
   is       => 'ro',
index 7a0d7e9..0e89098 100644 (file)
@@ -5,11 +5,7 @@ use Moose;
 
 use autodie;
 use Carp qw( carp croak );
-use DBIx::Class::DeploymentHandler::Logger;
-use Log::Contextual qw(:log :dlog), -package_logger =>
-  DBIx::Class::DeploymentHandler::Logger->new({
-    env_prefix => 'DBICDH'
-  });
+use DBIx::Class::DeploymentHandler::LogImporter qw(:log :dlog);
 use Context::Preserve;
 
 use Try::Tiny;
diff --git a/lib/DBIx/Class/DeploymentHandler/LogImporter.pm b/lib/DBIx/Class/DeploymentHandler/LogImporter.pm
new file mode 100644 (file)
index 0000000..a4c0b46
--- /dev/null
@@ -0,0 +1,16 @@
+package DBIx::Class::DeploymentHandler::LogImporter;
+
+use warnings;
+use strict;
+
+use parent 'Log::Contextual';
+
+use DBIx::Class::DeploymentHandler::Logger;
+
+my $logger = DBIx::Class::DeploymentHandler::Logger->new({
+   env_prefix => 'DBICDH'
+});
+
+sub arg_package_logger { $_[1] || $logger }
+
+1;
index 2e0a9f6..de6abd1 100644 (file)
@@ -1,10 +1,6 @@
 package DBIx::Class::DeploymentHandler::VersionStorage::Deprecated;
 use Moose;
-use DBIx::Class::DeploymentHandler::Logger;
-use Log::Contextual ':log', -package_logger =>
-  DBIx::Class::DeploymentHandler::Logger->new({
-    env_prefix => 'DBICDH'
-  });
+use DBIx::Class::DeploymentHandler::LogImporter ':log';
 
 
 # ABSTRACT: (DEPRECATED) Use this if you are stuck in the past
index a428534..dc9a7cc 100644 (file)
@@ -1,10 +1,6 @@
 package DBIx::Class::DeploymentHandler::VersionStorage::Standard;
 use Moose;
-use DBIx::Class::DeploymentHandler::Logger;
-use Log::Contextual ':log', -package_logger =>
-  DBIx::Class::DeploymentHandler::Logger->new({
-    env_prefix => 'DBICDH'
-  });
+use DBIx::Class::DeploymentHandler::LogImporter ':log';
 
 # ABSTRACT: Version storage that does the normal stuff