Module: Logging

Included in:
Rump
Defined in:
lib/rump.rb

Constant Summary collapse

ESCAPES =
{ :green  => "\033[0;32m",
:yellow => "\033[0;33m",
:red    => "\033[47;31m",
:reset  => "\033[0m" }

Instance Method Summary collapse

Instance Method Details

#emit(opts = {}) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/rump.rb', line 24

def emit(opts={})
  color   = opts[:color]
  message = opts[:message]
  print ESCAPES[color]
  print message
  print ESCAPES[:reset]
  print "\n"
end

#error(message) ⇒ Object



20
21
22
# File 'lib/rump.rb', line 20

def error(message)
  emit(:message => message, :color => :red)
end

#info(message) ⇒ Object



12
13
14
# File 'lib/rump.rb', line 12

def info(message)
  emit(:message => message, :color => :green)
end

#warn(message) ⇒ Object



16
17
18
# File 'lib/rump.rb', line 16

def warn(message)
  emit(:message => message, :color => :yellow)
end