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

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

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


Enum : in, out. Specifies if the other criterias are to be used to filter in or out. Defaults to 'in'.
Enum : public, private. Filters on the attribute type
a RegexpRef or a CodeRef. Used to filter on the attribute name. The CodeRef will recieve the attribute's name in $_
a RegexpRef or a CodeRef. Used to filter on the attribute value. The CodeRef will recieve the attribute's value in $_
a CodeRef. Used to do custom filtering. Will recieve the Class::MOP::Attribute as first argument, and $self as second argument.

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

Licensed under the same terms as perl itself.