Rails Objects Logger
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
- Fork it
- 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 new Pull Request