Fluentdly
Fluentdly is a wrapper for easily structured logging HTTP and non HTTP requests using fluent-logger.
Installation
Add this line to your application's Gemfile:
gem 'fluentdly'
And then execute:
$ bundle
Or install it yourself as:
$ gem install fluentdly
Examples
###Configure logger
Setup fluent-logger
parameters. See link
$logger = Fluentdly::Logger.new({:host => 'myhost', :port => 24224, :app_name => 'my_app'})
Configure fluentdly task logger:
Fluentdly.configure do |config|
config.task_logger = $logger
end
###Configure middleware HTTP params to log
Custom parameters will merge with default ones: :method, :query_string and :path
require 'fluentdly'
Fluentdly.configure do |config|
custom_parameters = {
:user_agent => 'HTTP_USER_AGENT',
:uri => 'REQUEST_URI'
}
config.request_parameters custom_parameters
end
###Task logging example
Fluentdly::Task.log(:info, {:log_param => 'log_information' ... }) do
your_business_logic_here
[status, result]
end
###Setup middleware
For instance in config.ru for rack applications:
use Fluentdly::Rack::Middleware
License
The gem is available as open source under the terms of the MIT License.