From: Arthur Axel 'fREW' Schmidt Date: Sat, 21 Jul 2012 05:02:49 +0000 (-0500) Subject: make logging suck less X-Git-Tag: v0.002200~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=562030878a850a01073774f27769748077c79176;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git make logging suck less --- diff --git a/dist.ini b/dist.ini index f9dda5d..03043ca 100644 --- 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 diff --git a/lib/DBIx/Class/DeploymentHandler/Dad.pm b/lib/DBIx/Class/DeploymentHandler/Dad.pm index f06336f..4b3c7fc 100644 --- a/lib/DBIx/Class/DeploymentHandler/Dad.pm +++ b/lib/DBIx/Class/DeploymentHandler/Dad.pm @@ -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', diff --git a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm index 7a0d7e9..0e89098 100644 --- a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm +++ b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm @@ -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 index 0000000..a4c0b46 --- /dev/null +++ b/lib/DBIx/Class/DeploymentHandler/LogImporter.pm @@ -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; diff --git a/lib/DBIx/Class/DeploymentHandler/VersionStorage/Deprecated.pm b/lib/DBIx/Class/DeploymentHandler/VersionStorage/Deprecated.pm index 2e0a9f6..de6abd1 100644 --- a/lib/DBIx/Class/DeploymentHandler/VersionStorage/Deprecated.pm +++ b/lib/DBIx/Class/DeploymentHandler/VersionStorage/Deprecated.pm @@ -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 diff --git a/lib/DBIx/Class/DeploymentHandler/VersionStorage/Standard.pm b/lib/DBIx/Class/DeploymentHandler/VersionStorage/Standard.pm index a428534..dc9a7cc 100644 --- a/lib/DBIx/Class/DeploymentHandler/VersionStorage/Standard.pm +++ b/lib/DBIx/Class/DeploymentHandler/VersionStorage/Standard.pm @@ -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