Class: Pairzone::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/pairzone/logger.rb

Class Method Summary collapse

Class Method Details

.ask(msg, &block) ⇒ Object



28
29
30
# File 'lib/pairzone/logger.rb', line 28

def ask(msg, &block)
  stdout.ask(msg, &block)
end

.configure_from(globals) ⇒ Object



4
5
6
# File 'lib/pairzone/logger.rb', line 4

def configure_from(globals)
  @level = globals[:d]
end

.debug(msg) ⇒ Object



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

def debug(msg)
  stderr.say("<%= color('debug:', YELLOW + BOLD) %> #{msg}") if @level
end

.error(msg) ⇒ Object



24
25
26
# File 'lib/pairzone/logger.rb', line 24

def error(msg)
  stdout.say("<%= color('Pairzone error:', RED + BOLD) %> #{msg}")
end

.info(msg) ⇒ Object



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

def info(msg)
  stdout.say(msg)
end

.stderrObject



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

def stderr
  @stderr ||= HighLine.new($stdin, $stderr)
end

.stdoutObject



8
9
10
# File 'lib/pairzone/logger.rb', line 8

def stdout
  @stdout ||= HighLine.new($stdin, $stdout)
end