Log::Message::Structured::Stringify::AsJSON - JSON log lines
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"}
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.
as_string
objToJson
Returns the event as JSON
Tomas Doran (t0m) <bobtfish@bobtfish.net>. Damien Krotkine (dams) <dams@cpan.org>.
<bobtfish@bobtfish.net>
<dams@cpan.org>
Licensed under the same terms as perl itself.
To install Log::Message::Structured, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::Message::Structured
CPAN shell
perl -MCPAN -e shell install Log::Message::Structured
For more information on module installation, please visit the detailed CPAN module installation guide.