Rails Objects Logger Build Status Dependency Status Code Climate endorse

Implement debug, info, warn and error class methods to all Rails objects in order to log anything very easily. This gem is part of Citaskit.

Installation

Add this line to your application's Gemfile:

gem 'rails_objects_logger'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rails_objects_logger

Usage

class MyObject
  def initialize
    MyObject.info "Initializing..."
  end

  def my_function_1
    debug "Calling my_function_1"
  end

  def build_new_thing
    self.error "You can't call this method!"
  end
end

Will produce those log lines in your Rails log/development.log file:

Info#MyObject: Initializing...
Debug#MyObject: Calling my_function_1
Error#MyObject: You can't call this method!

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request