ppp_coloring
Overview
With the ppp method, you can add color to console output.
Are you ever frustrated when the Rails log output in your console isn't colored for debugging purposes?
ppp_coloring solves this problem.
It can also be conveniently used when running in Docker containers or when checking Sidekiq logs.
Installation Method
gem 'ppp_coloring', '~> 0.1.3'Usage in Rails
If you want to use it as easily as the p method, register it in initializers.
Create a file like ppp_initializer.rb in api/config/initializers and register as follows:
def ppp(*args)
PppColoring.ppp(*args)
endIf you want to use the ppp output only during debugging, it is good to call it as follows:
def ppp(*args)
PppColoring.ppp(*args) if Rails.env.development?
endUsage
The second argument is optional. (It defaults to :info if omitted)
ppp "test", :info
ppp "test", :warn
ppp "test", :error
ppp "test", :successWhat is happening internally?
Internally, the ppp method outputs to the console using the puts method.
It is very simple.
