[Bast-commits] r9780 - SQL-Abstract/1.x/branches/log-sprintf/lib/DBIx/Class/Storage/Debug

frew at dev.catalyst.perl.org frew at dev.catalyst.perl.org
Sat Oct 23 10:30:21 GMT 2010


Author: frew
Date: 2010-10-23 10:30:21 +0000 (Sat, 23 Oct 2010)
New Revision: 9780

Modified:
   SQL-Abstract/1.x/branches/log-sprintf/lib/DBIx/Class/Storage/Debug/PrettyPrint.pm
Log:
use Log::Sprintf to format DBIx::Class messages

Modified: SQL-Abstract/1.x/branches/log-sprintf/lib/DBIx/Class/Storage/Debug/PrettyPrint.pm
===================================================================
--- SQL-Abstract/1.x/branches/log-sprintf/lib/DBIx/Class/Storage/Debug/PrettyPrint.pm	2010-10-23 08:48:36 UTC (rev 9779)
+++ SQL-Abstract/1.x/branches/log-sprintf/lib/DBIx/Class/Storage/Debug/PrettyPrint.pm	2010-10-23 10:30:21 UTC (rev 9780)
@@ -6,16 +6,21 @@
 use base 'DBIx::Class::Storage::Statistics';
 
 use SQL::Abstract::Tree;
+use Log::Sprintf;
 
 __PACKAGE__->mk_group_accessors( simple => '_sqlat' );
+__PACKAGE__->mk_group_accessors( simple => '_lsprint' );
 
 sub new {
    my $class = shift;
+   my $args = shift;
 
-   my $sqlat = SQL::Abstract::Tree->new(shift @_);
+   my $lsprint = Log::Sprintf->new(delete $args->{log_sprintf});
+   my $sqlat = SQL::Abstract::Tree->new($args);
    my $self = $class->next::method(@_);
 
    $self->_sqlat($sqlat);
+   $self->_lsprint($lsprint);
 
    return $self
 }
@@ -35,6 +40,8 @@
   $formatted = "$formatted: " . join ', ', @{$bindargs}
      unless $use_placeholders;
 
+  $formatted = $self->_lsprint->sprintf({ message => $formatted });
+
   $self->next::method($formatted, @_);
 }
 




More information about the Bast-commits mailing list