From: Arthur Axel 'fREW' Schmidt Date: Tue, 16 Feb 2010 05:28:20 +0000 (-0600) Subject: super basic test logger for showing off X-Git-Tag: v0.00100~30^2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=529da3ef01115fed668e657d9e5e130cca48b1fd;p=p5sagit%2FLog-Contextual.git super basic test logger for showing off --- diff --git a/t/lib/WarnLogger.pm b/t/lib/WarnLogger.pm new file mode 100644 index 0000000..b64f540 --- /dev/null +++ b/t/lib/WarnLogger.pm @@ -0,0 +1,12 @@ +package WarnLogger; + +use POSIX qw(strftime); +sub new { bless {}, __PACKAGE__ } +sub debug { + my @caller = caller(1); + my $time = strftime "%y-%m-%d %H:%M:%S", localtime; + warn "[$time][$caller[0]][$caller[1]][$caller[2]][$_[1]]\n" +} +sub is_debug { 1 } + +1; diff --git a/t/play.t b/t/play.t new file mode 100644 index 0000000..d1add5e --- /dev/null +++ b/t/play.t @@ -0,0 +1,17 @@ +use strict; +use warnings; + +use lib 't/lib'; +use WarnLogger; +use Log::Contextual; +use Test::More qw(no_plan); + +my $logger = WarnLogger->new; + +set_logger { $logger }; +log_debug { 'set_logger' }; +log_debug { 'simple log 1' }; +log_debug { 'simple log 2' }; +sleep 1; +log_debug { 'simple log 3' }; +