Skip to content

Commit

Permalink
Fix stacktrace option (T)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Axel 'fREW' Schmidt committed Jul 4, 2014
1 parent fd47792 commit 2cb268a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Revision history for {{$dist->name}}

{{$NEXT}}
- Fix stacktrace option (T)
- Fix warning coming from SQL::Abstract::Tree

0.001002 2013-03-02 10:31:56 CST6CDT
Expand Down
1 change: 1 addition & 0 deletions lib/DBIx/Class/UnicornLogger.pm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ my %code_to_method = (
p => 'log_priority',
r => 'log_milliseconds_since_start',
R => 'log_milliseconds_since_last_log',
T => 'log_stacktrace',
);

sub BUILDARGS {
Expand Down
30 changes: 30 additions & 0 deletions t/structured.t
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,34 @@ use DBIx::Class::UnicornLogger;
like $lines[2], qr/\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\] WHERE id = '1'/;
}

{
my $cap;
open my $fh, '>', \$cap;

my $pp = DBIx::Class::UnicornLogger->new({
squash_repeats => 1,
tree => {
profile => 'console_monochrome',
fill_in_placeholders => 1,
placeholder_surround => ['', ''],
},
format => "%T%n%m",
multiline_format => '%m',
show_progress => 0,
});

$pp->debugfh($fh);

$pp->query_start('SELECT * FROM frew WHERE id = ?', q('1'));
# should do nothing
$pp->query_end('SELECT * FROM frew WHERE id = ?', q('1'));

my @lines = split /\n/, $cap;

like $lines[-4], qr/structured\.t/;
like $lines[-3], qr/SELECT \* /;
like $lines[-2], qr/ FROM frew /;
like $lines[-1], qr/WHERE id = '1'/;
}

done_testing();

0 comments on commit 2cb268a

Please sign in to comment.