Output/Fluentd.pm untested

filter: Statementstmt 0.0% 0 / 25 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 41 CC 2 SCAR 11.0
CC
2
Cov
0%
consume
6.0
connected
2.0
BEGIN
2.0
CRAP 3.0
1 package Message::Passing::Output::Fluentd;
2  
3 use Moo;
4 use namespace::autoclean;
5 use Try::Tiny;
6 use JSON::MaybeXS qw( decode_json );
7 use Message::Passing::Exception::Decoding;
8  
9 with qw(
10 Message::Passing::Fluentd::Role::HasAConnection
11 Message::Passing::Role::Output
12 );
13  
14 has tag => ( is => 'ro', default => sub { 'app_log' });
15  
16 sub consume {
17 my ($self, $msg) = @_;
18 $msg = try {
19 ref($msg) ? $msg : decode_json($msg)
20 } catch {
21 $self->error->consume(Message::Passing::Exception::Decoding->new(
22 exception => $_,
23 packed_data => $msg,
24 ));
25 return; # Explicit return undef
26 };
27 $self->connection_manager->connection->post(
28 delete($msg->{'tag'}) || $self->tag,
29 $msg
30 );
31 }
32  
33 sub connected {}
34  
35 1;
36  
37 __END__