From fc64714f04d5018ba251f3cbfa98cbaf0f94adb6 Mon Sep 17 00:00:00 2001 From: jasonjayr Date: Tue, 19 Dec 2006 12:36:34 +0000 Subject: Added support for full stack backtrace, via Carp git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@749 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/Log.pm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/LedgerSMB/Log.pm b/LedgerSMB/Log.pm index f816660b..558578ec 100644 --- a/LedgerSMB/Log.pm +++ b/LedgerSMB/Log.pm @@ -31,6 +31,14 @@ Available methods: (in order, most to least severe) =item debug +=item longmess + +This uses Carp to make a debug message with the full stack backtrace, including function arguments, where Carp can infer them. + +=item dump + +This uses Data::Dumper to dump the contents of a data structure as a debug message. + =back =cut @@ -41,6 +49,7 @@ use warnings; use IO::File; use Data::Dumper; use LedgerSMB::Sysconfig; +use Carp (); our $fh; @@ -76,11 +85,14 @@ sub warn { shift->print('warn',@_) } sub notice { shift->print('notice',@_) } sub info { shift->print('info',@_) } sub debug { shift->print('debug',@_) } + +sub longmess { shift->print('debug',Carp::longmess(@_)) } + sub dump { my $self = shift; my $d = Data::Dumper->new([@_]); $d->Sortkeys(1); - $self->print('dump',$d->Dump()); + $self->print('debug',$d->Dump()); } 1; -- cgit v1.2.3