class Bump::Logger

The logging class

Public Class Methods

new(no_color = nil) click to toggle source
# File lib/bump/logger.rb, line 4
def initialize(no_color = nil)
  @no_color = no_color
end

Public Instance Methods

colorize(text, color_code) click to toggle source

Colorize the text by the color code.

@param [String] text @param [Integer] color_code @return [String]

# File lib/bump/logger.rb, line 24
def colorize(text, color_code)
  if @no_color
    text
  else
    "\e[#{color_code}m#{text}\e[0m"
  end
end
green(text) click to toggle source

Returns a green string.

@param [String] text @return [String]

# File lib/bump/logger.rb, line 36
def green(text)
  colorize text, 32
end
log(message = '', breakline = true) click to toggle source

Logs the message.

@param [String] message @param [Boolean] breakline @return [void]

# File lib/bump/logger.rb, line 13
def log(message = '', breakline = true)
  print message

  print "\n" if breakline
end
red(text) click to toggle source

Returns a red string.

@param [String] text @return [String]

# File lib/bump/logger.rb, line 44
def red(text)
  colorize text, 31
end