Class: AutoPilot::Log

Inherits:
Logger
  • Object
show all
Defined in:
lib/auto_pilot/util/log.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.messageObject

Returns the value of attribute message.



7
8
9
# File 'lib/auto_pilot/util/log.rb', line 7

def message
  @message
end

Class Method Details

.colorize(text, color_code) ⇒ Object



13
14
15
# File 'lib/auto_pilot/util/log.rb', line 13

def colorize(text, color_code)
  $stdout.write "\e[#{color_code}m#{text}\e[0m\n"
end

.green(text) ⇒ Object



28
29
30
31
32
# File 'lib/auto_pilot/util/log.rb', line 28

def green(text)
  @message = text
  colorize(text, 32)
  logger.info text
end

.out(text) ⇒ Object



9
10
11
# File 'lib/auto_pilot/util/log.rb', line 9

def out(text)
  $stdout.write "#{text}\n"
end

.red(text) ⇒ Object



17
18
19
20
21
# File 'lib/auto_pilot/util/log.rb', line 17

def red(text)
  @message = text
  colorize(text, 31)
  logger.error text
end

.yellow(text) ⇒ Object



23
24
25
26
# File 'lib/auto_pilot/util/log.rb', line 23

def yellow(text)
  @message = text
  colorize(text, 33)
end