From: Arthur Axel 'fREW' Schmidt Date: Sun, 14 Feb 2010 08:18:44 +0000 (-0600) Subject: add Log::Contextual::Sugar X-Git-Tag: v0.00100~36 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f7f951dcb13daeaf08993614d5b2de299200334a;p=p5sagit%2FLog-Contextual.git add Log::Contextual::Sugar --- diff --git a/lib/Log/Contextual/Sugar.pm b/lib/Log/Contextual/Sugar.pm new file mode 100644 index 0000000..eecc46d --- /dev/null +++ b/lib/Log/Contextual/Sugar.pm @@ -0,0 +1,30 @@ +package Log::Contextual::Sugar; + +require Exporter; + +BEGIN { @ISA = qw(Exporter) } + +@EXPORT = qw(Dlog_debug DlogS_debug); + +use Data::Dumper::Concise; +use Log::Contextual (); + +sub Dlog_debug (&@) { + my $code = shift; + my @values = @_; + Log::Contextual::log_debug { + do { local $_ = Data::Dumper::Concise::Dumper @values; $code->() }; + }; + @values +} + +sub DlogS_debug (&$) { + my $code = $_[0]; + my $value = $_[1]; + Log::Contextual::log_debug { + do { local $_ = Data::Dumper::Concise::Dumper $value; $code->() }; + }; + $value +} + +1;