NAME
Log::Message::Structured::Stringify::AsJSON - JSON log lines
SYNOPSIS
package MyLogEvent;
use Moose;
use namespace::autoclean;
# Note: you MUST compose these together as they depend on methods in each other
with qw/
Log::Message::Structured
Log::Message::Structured::Stringify::AsJSON
/;
has foo => ( is => 'ro', required => 1 );
... elsewhere ...
use aliased 'My::Log::Event';
$logger->log(message => Event->new( foo => "bar" ));
# Logs:
{"__CLASS__":"MyLogEvent","foo":1,"date":"2010-03-28T23:15:52Z","hostname":"mymachine.domain"}
DESCRIPTION
Implelements the stringify
method required by Log::Message::Structured, by delegateing to the freeze
method provided by Log::Message::Structured, and thus returning a JSON string.
METHODS
stringify
Calls the freeze method (provided by Log::Message::Structured to return JSON.
AUTHOR AND COPYRIGHT
Tomas Doran (t0m) <bobtfish@bobtfish.net>
.
LICENSE
Licensed under the same terms as perl itself.