The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Log::Message::Structured::Component::AttributesFilter

SYNOPSIS

    package MyLogEvent;
    use Moose;
    use namespace::autoclean;

    with ('Log::Message::Structured',
          'Log::Message::Structured::Stringify::AsJSON',
          'Log::Message::Structured::Component::AttributesFilter' => {
             filter => 'out',
             name => qr /^foo/,
           });

    has [qw/ foo bar /] => ( is => 'ro', required => 1 );

    ... elsewhere ...

    use aliased 'My::Log::Event';

    $logger->log(Event->new( foo => "ONE MILLION", bar => "ONE BILLION" ));
    # Logs:
    {"__CLASS__":"MyLogEvent","foo":"ONE MILLION"}
    # note that bar is not included in the structure

DESCRIPTION

Augments the as_string method provided by Log::Message::Structured as a parameterised Moose role.

PARAMETERS

filter

Enum : in, out. Specifies if the other criterias are to be used to filter in or out. Defaults to 'in'.

type

Enum : public, private. Filters on the attribute type

name

a RegexpRef or a CodeRef. Used to filter on the attribute name. The CodeRef will recieve the attribute's name in $_

value

a RegexpRef or a CodeRef. Used to filter on the attribute value. The CodeRef will recieve the attribute's value in $_

custom

a CodeRef. Used to do custom filtering. Will recieve the Class::MOP::Attribute as first argument, and $self as second argument.

AUTHOR AND COPYRIGHT

Damien Krotkine (dams) <dams@cpan.org>.

LICENSE

Licensed under the same terms as perl itself.