DBIC_TRACE with timestamp / line numbers?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

DBIC_TRACE with timestamp / line numbers?

Andy Smith
Hi,

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?

I saw DBIC_TRACE_PROFILE and that all looks useful but couldn't see
an obvious way to make it do those particular things.

So, what do others do?

Cheers,
Andy

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: DBIC_TRACE with timestamp / line numbers?

Andy Smith
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

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Loading...