NAME
Log::Message::Structured::Stringify::AsJSON - JSON log lines
SYNOPSIS
package MyLogEvent;
use Moose;
use namespace::autoclean;
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
Augments the as_string
method provided by Log::Message::Structured as a, by delegateing to the objToJson
from JSON::Any module, and thus returning a JSON string.
METHODS
as_string
Returns the event as JSON
AUTHOR AND COPYRIGHT
Tomas Doran (t0m) <bobtfish@bobtfish.net>
. Damien Krotkine (dams) <dams@cpan.org>
.
LICENSE
Licensed under the same terms as perl itself.