[Dbix-class] DBIC_TRACE with timestamp / line numbers?

Andy Smith andy at strugglers.net
Sun Mar 22 18:32:11 GMT 2015


Hi Peter,

On Fri, Mar 20, 2015 at 01:27:43PM +0100, Peter Rabbitson wrote:
> On 03/20/2015 01:23 PM, Andy Smith wrote:
> >Is there an obvious way I have missed to prepend a time stamp to the
> >output that setting DBIC_TRACE puts out on STDERR? Or should I just
> >direct that output to my own logging which adds that?
> >
> >Also same question but for __FILE__ and __LINE__ etc?

[…]

> https://metacpan.org/pod/DBIx::Class::UnicornLogger#new based on
> https://metacpan.org/pod/Log::Sprintf#formats

Thanks, I see just using that format gets me the datetime.

For the file/line/subroutine though, the F, L and M formats will
only report the caller as being something inside DBIx::Class, and
the T format gives the whole stacktrace.

I may be wrong (I am new to this) but I don't think I can subclass
Log::Sprintf to add my own formats as DBIx::Class::UnicornLogger
uses Log::Sprintf directly.

Maybe I should just subclass DBIx::Class::UnicornLogger and override
query_start to $self->print the desired layer of caller() and then
call $self->SUPER::query_start to get the rest of the logging
infrastructure from DBIx::Class::UnicornLogger?

Cheers,
Andy



More information about the DBIx-Class mailing list