0.0
The project is in a healthy, maintained state
Library for coloring strings in console output
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

ppp_coloring

image

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)
end

If 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?
end

Usage

The second argument is optional. (It defaults to :info if omitted)

ppp "test", :info
ppp "test", :warn
ppp "test", :error
ppp "test", :success

What is happening internally?

Internally, the ppp method outputs to the console using the puts method. It is very simple.