Railsochrome
Project was created just for fun and out of curiosity.
The idea of this project is to print log messages from the Rails app in a Chrome console. It will work even if you have a simple JSON API call.
What is funny, is that it can log messages from the models. Just call a class method Railsochrome.log.
How it works see on the diagram below:
Usage
-
Clone the repo
-
Install chrome extension from the source code.
- Add gem and use in your code:
# controller
def index
Railsochrome.log("Opening index action")
Railsochrome.log("user_id = #{rand(111)}")
Railsochrome.log("account_id = #{rand(111)}")
@projects = Project.all
end
# model
class Project < ApplicationRecord
after_initialize do
Railsochrome.log("after_initialize project id=#{self.id}")
end
end
- Result:
Installation
gem "railsochrome"
And then execute:
$ bundle
Or install it yourself as:
$ gem install railsochrome
Contributing
Contribution directions go here.
License
The gem is available as open source under the terms of the MIT License.