[SCM] libmessage-passing-perl Debian packaging branch, master, updated. debian/0.111-3-14-g44f6e88
Tomas Doran
bobtfish at bobtfish.net
Mon May 6 11:56:47 UTC 2013
The following commit has been merged in the master branch:
commit fbdd80c2784dee6b3063e9e8f7272083c6b2bf4c
Author: Tomas Doran <bobtfish at bobtfish.net>
Date: Fri Mar 23 00:55:10 2012 +0000
Make a callback output
diff --git a/lib/Log/Stash/Output/Null.pm b/lib/Log/Stash/Output/Callback.pm
similarity index 62%
copy from lib/Log/Stash/Output/Null.pm
copy to lib/Log/Stash/Output/Callback.pm
index a655e6a..dc12b6a 100644
--- a/lib/Log/Stash/Output/Null.pm
+++ b/lib/Log/Stash/Output/Callback.pm
@@ -1,34 +1,33 @@
-package Log::Stash::Output::Null;
+package Log::Stash::Output::Callback;
use Moose;
use namespace::autoclean;
-with 'Log::Stash::Role::Output';
+has cb => (
+ isa => 'CodeRef',
+ is => 'ro',
+);
+
+sub consume {
+ my ($self, $msg) = @_;
+ $self->cb->($msg);
+}
-sub consume {}
+with 'Log::Stash::Role::Output';
__PACKAGE__->meta->make_immutable;
1;
=head1 NAME
-Log::Stash::Output::Null - /dev/null for logstash messages
+Log::Stash::Output::Callback - Output to call back into your code
=head1 SYNOPSIS
- logstash --input STDIN --output Null
- {"foo": "bar"}
-
- # Note noting is printed...
-
-=head1 DESCRIPTION
-
-Throws away all messages passed to it.
-
-=head1 METHODS
-
-=head2 consume
-
-Takes a message and discards it silently.
+ Log::Stash::Output::Callback->new(
+ cb => sub {
+ my $message = shift;
+ },
+ );
=head1 SEE ALSO
@@ -48,3 +47,5 @@ See L<Log::Stash>.
=cut
+1;
+
--
libmessage-passing-perl Debian packaging
More information about the Pkg-perl-cvs-commits
mailing list