class AxeLogger
Constants
- COLOR_CONFIG
- STACK_EXP
- STACK_LEVEL
Attributes
date_format[RW]
Public Class Methods
new(*opts)
click to toggle source
Calls superclass method
# File lib/axe_logger.rb, line 21 def initialize (*opts) @date_format = '%m/%d/%Y %H:%M:%S' super end
Public Instance Methods
format_message(severity, datetime, progname, msg)
click to toggle source
# File lib/axe_logger.rb, line 26 def format_message severity, datetime, progname, msg m = STACK_EXP.match caller[STACK_LEVEL+1].split('/').last time = datetime.strftime date_format color = COLOR_CONFIG[severity.downcase.to_sym] string_with_color("#{time} #{m[:file]}:#{m[:line]} (#{m[:func]}): ", color) + "#{msg}\n" end
Private Instance Methods
string_with_color(str, color)
click to toggle source
# File lib/axe_logger.rb, line 37 def string_with_color str, color "\e[#{color}m#{str}\e[0;0m" end