Write logs messages to multiple destinations.
Installation
Add this line to your application's Gemfile:
gem 'log_tribe'
And then execute:
$ bundle
Or install it yourself as:
$ gem install log_tribe
Usage
Basic example
log = LogTribe::Loggers.new([Logger.new(STDOUT), Fluent::Logger::FluentLogger.new(nil, host: 'srv', port: 10_010)],
{ tag_name: 'app_name.app_type' })
log.info 'this log message is send to the 2 loggers passed in parameters'
log.debug 'debug message send too...'
log.close # Or not...
Sinatra example
# your_sinatra_app.rb
require 'log_tribe'
# ...
configure do
# ...
log_tribe = LogTribe::Loggers.new([Logger.new(STDOUT),
Fluent::Logger::FluentLogger.new(nil, host: 'srv', port: 10_010)])
use Rack::CommonLogger, log_tribe
end
# ...
Contributing
- Fork it ( https://github.com/fenicks/log_tribe/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request