Class: FCSHD::Logger

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

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ Logger

Returns a new instance of Logger.



3
4
5
# File 'lib/fcshd/logger.rb', line 3

def initialize(output)
  @output = output
end

Instance Method Details

#die(message) ⇒ Object



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

def die(message)
  error message
  exit 1
end

#dump(output) ⇒ Object



13
14
15
# File 'lib/fcshd/logger.rb', line 13

def dump(output)
  @output.puts output.chomp
end

#error(message) ⇒ Object



17
18
19
20
21
# File 'lib/fcshd/logger.rb', line 17

def error(message)
  for line in message.lines
    log "error: #{line.chomp}"
  end
end

#log(message) ⇒ Object



7
8
9
10
11
# File 'lib/fcshd/logger.rb', line 7

def log(message)
  for line in message.lines
    @output.puts "#{File.basename($0)}: #{line.chomp}"
  end
end