Class: UltraMarathon::Logger

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/ultra_marathon/logger.rb

Constant Summary collapse

NEW_LINE =
"\n".freeze

Instance Method Summary collapse

Instance Method Details

#contentsObject

Returns a copy of the log data so it cannot be externally altered



25
26
27
# File 'lib/ultra_marathon/logger.rb', line 25

def contents
  log_string.dup
end

#error(error) ⇒ Object Also known as: err



16
17
18
19
20
21
22
# File 'lib/ultra_marathon/logger.rb', line 16

def error(error)
  if error.is_a? Exception
    log_formatted_error(error)
  else
    info error
  end
end

#info(line) ⇒ Object Also known as: emerg, warning, notice, debug

Adds the line plus a newline



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

def info(line)
  return if line.empty?
  log_string << padded_line(line)
end