diff options
author | doy <doy@tozt.net> | 2008-11-26 16:01:22 -0500 |
---|---|---|
committer | doy <doy@tozt.net> | 2008-11-26 16:01:22 -0500 |
commit | b32c7b47006c193d41340c175ff866d3a607c43b (patch) | |
tree | 47e0b4e07f326d62bb140a3b4fa4ca6c35df0082 | |
parent | 6f980fb52125024b498f11db3276a0ec150a7efe (diff) | |
download | log-dispatch-channels-b32c7b47006c193d41340c175ff866d3a607c43b.tar.gz log-dispatch-channels-b32c7b47006c193d41340c175ff866d3a607c43b.zip |
add an output module to help with testing (that just outputs to an internal buffer)
-rw-r--r-- | t/lib/Log/Dispatch/ToString.pm | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/t/lib/Log/Dispatch/ToString.pm b/t/lib/Log/Dispatch/ToString.pm new file mode 100644 index 0000000..9819c29 --- /dev/null +++ b/t/lib/Log/Dispatch/ToString.pm @@ -0,0 +1,26 @@ +#!/usr/bin/perl +use strict; +use warnings; +package Log::Dispatch::ToString; +use base 'Log::Dispatch::Output'; + +sub new { + my $class = shift; + my $self = bless {}, $class; + $self->_basic_init(@_); + $self->{_string} = ''; + return $self; +} + +sub log_message { + my $self = shift; + my %args = @_; + $self->{_string} .= $args{message}; +} + +sub get_string { + my $self = shift; + return $self->{_string}; +} + +1; |