| 1 | package Plack::Middleware::AccessLog::Structured::ZeroMQ; | ||
| 2 | $Plack::Middleware::AccessLog::Structured::ZeroMQ::VERSION = '0.001001'; | ||
| 3 | 2 | ▶ | use parent qw(Plack::Middleware::AccessLog::Structured); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | # ABSTRACT: Access log middleware which passes structured log messages into ZeroMQ | ||
| 6 | |||
| 7 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 2 | ▶ | use MRO::Compat; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 0 | ▶ | use Message::Passing::Output::ZeroMQ; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 12 | |||
| 13 | |||
| 14 | |||
| 15 | sub new { | ||
| 16 | my ($class, $arg_ref) = @_; | ||
| 17 | |||
| 18 | my $self = $class->next::method($arg_ref); | ||
| 19 | |||
| 20 | unless ($self->logger()) { | ||
| 21 | my $output = Message::Passing::Output::ZeroMQ->new( | ||
| 22 | connect => $self->{connect} || 'tcp://127.0.0.1:5552', | ||
| 23 | ); | ||
| 24 | $self->logger(sub { | ||
| 25 | $output->consume(@_); | ||
| 26 | }); | ||
| 27 | } | ||
| 28 | |||
| 29 | return $self; | ||
| 30 | } | ||
| 31 | |||
| 32 | |||
| 33 | |||
| 34 | 1; | ||
| 35 | |||
| 36 | __END__ | ||