Skip to content
Easy Fluent Logging for Sinatra-based Applications
Ruby Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
lib
spec
.gitignore
.rspec
.travis.yml
CODE_OF_CONDUCT.md
Gemfile
LICENSE.txt
README.md
Rakefile
fluent-logger-sinatra-0.1.0.gem
fluent-logger-sinatra-0.1.1.gem
fluent-logger-sinatra-0.1.2.gem
fluent-logger-sinatra.gemspec

README.md

FluentLoggerSinatra

Build Status

Fluent Logger Sinatra was made for Sinatra apps, but can also be used in Ruby on Rails applications, if you'd like multiple loggers in your application to log specific things.

If you're converting from using Loggers in your app, fluent-logger-ruby does not support the basic methods that the Ruby Logger does, like info, warn, error, etc.

Especially if you're using a gem that logs in the background, like Delayed Job, Delayed Job will expect to be able to call info, debug, etc. on the logger you provide it.

In addition, Sinatra applications expect to be able to call the method write on any logger you provide it. So here's the solution: fluent-logger-sinatra!

Installation

Add this line to your application's Gemfile:

gem 'fluent-logger-sinatra'

And then execute:

$ bundle

Or install it yourself as:

$ gem install fluent-logger-sinatra

Usage

Initalize an instance of the logger The first argument is the tag prefix, the second argument is an option tag suffix, the third is the host IP, and the fourth is the port number

logger = FluentLoggerSinatra::Logger.new('myapp', 'delayed_job', '127.0.0.1', 24224)
logger.info("Delayed Job running on port ###")

If you're using a Sinatra app:

use ::Rack::CommonLogger, logger

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/sliuu/fluent-logger-sinatra. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

You can’t perform that action at this time.