Log::Dispatch::MongoDB - A MongoDB backend for Log::Dispatch
version 0.001
my $log = Log::Dispatch->new; $log->add( Log::Dispatch::MongoDB->new( name => 'my_web_logger', min_level => 'debug', collection => $mongo_db->get_collection('web_log') ) ); $log->debug("Testing feature $x"); $log->log( level => 'info', message => 'Started processing web page', info => { referer => $ENV{HTTP_REFERER}, user_agent => $ENV{HTTP_USER_AGENT}, remote_addr => $ENV{REMOTE_ADDR}, } );
This is a MongoDB backend for Log::Dispatch.
MongoDB is especially adept for logging because of it's asynchronous insert behavior, which means that your logging won't slow down your application. It is also nice in that you can store structured data as well as simple messages.
With the log method, we not only store the level and message, but we store any other information you choose to passed in. Note that this feature does not work if you use the info, warn, debug methods, etc.
log
info
warn
debug
http://blog.mongodb.org/post/172254834/mongodb-is-fantastic-for-logging
Stevan Little <stevan.little@iinteractive.com>
This software is copyright (c) 2011 by Infinity Interactive, Inc..
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Log::Dispatch::MongoDB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::Dispatch::MongoDB
CPAN shell
perl -MCPAN -e shell install Log::Dispatch::MongoDB
For more information on module installation, please visit the detailed CPAN module installation guide.