Class: RCoLi::Log

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/rcoli/utils.rb

Instance Method Summary collapse

Constructor Details

#initializeLog

Returns a new instance of Log.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/rcoli/utils.rb', line 24

def initialize
  @log = Logger.new(STDOUT)
  @log.level = Logger::INFO
  @log.formatter = proc do |severity, datetime, progname, msg|
    case severity
    when "DEBUG"
      color = 'gray27'
    else
      color = :white
    end
    
    if STDOUT.tty?
      Paint["#{msg}\n", color]
    else
      "#{msg}\n"
    end
    
  end
end

Instance Method Details

#loggerObject



44
45
46
# File 'lib/rcoli/utils.rb', line 44

def logger
  @log
end