class GALogger
@author Vittorio Monaco
Public Class Methods
log(message, type = :Default, padding = '
click to toggle source
Logs a message on the console
@param message [String] a string to log @param type [Symbol] specifies the type of message. This can be :Error, :Warning, :Success or :Default @param padding [String] the padding to put before and after the message
@note depending on the message type, a different color will be used to print the message on the console
# File lib/ga_logger.rb, line 15 def self.log(message, type = :Default, padding = ' ### ') puts sequenceForType(type) + padding + message + padding + sequenceForType(:Default) end
sequenceForType(type)
click to toggle source
Returns the character code to print with the right color given a message type
@param type [Symbol] the message type. This can be :Error, :Warning, :Success or :Default
# File lib/ga_logger.rb, line 22 def self.sequenceForType(type) case type when :Success return "\033[32m" when :Error return "\033[31m" when :Warning return "\033[33m" else return "\033[0m" end end