Skip to content

pnpk/ppp_coloring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors