class RedLine::Logger
Constants
- COLORS
Public Class Methods
color_code(code)
click to toggle source
# File lib/red_line/logger.rb, line 19 def self.color_code(code) COLORS.fetch(code) { raise(ArgumentError, "Color #{code} not supported.") } end
colorize(input, color:)
click to toggle source
# File lib/red_line/logger.rb, line 23 def self.colorize(input, color:) "\e[#{color_code(color)}m#{input}\e[0m" end
log(topic:, message:)
click to toggle source
# File lib/red_line/logger.rb, line 27 def self.log(topic:, message:) puts "#{print_topic(topic)} #{message}" end
Also aliased as: l
print_topic(topic)
click to toggle source
# File lib/red_line/logger.rb, line 31 def self.print_topic(topic) topic_string = "[#{topic}]" color = case topic.to_sym when :primary_session :green when :previous_session, :back_to_session :yellow when :facebook, :twilio, :bandwidth :blue when :smooch :magenta when :alexa :light_cyan when :catch_all :red when :user :white else :gray end colorize(topic_string, color: color) end