Module: Creeper::OutLogger

Extended by:
OutLogger
Included in:
OutLogger
Defined in:
lib/creeper/out_logger.rb

Instance Method Summary collapse

Instance Method Details

#crash(string, exception) ⇒ Object

Handle a crash



27
28
29
30
# File 'lib/creeper/out_logger.rb', line 27

def crash(string, exception)
  string << "\n" << format_exception(exception)
  error string
end

#debug(string) ⇒ Object

Send a debug message



7
8
9
# File 'lib/creeper/out_logger.rb', line 7

def debug(string)
  Creeper.out_logger.debug(string) if Creeper.out_logger
end

#error(string) ⇒ Object

Send an error message



22
23
24
# File 'lib/creeper/out_logger.rb', line 22

def error(string)
  Creeper.out_logger.error(string) if Creeper.out_logger
end

#format_exception(exception) ⇒ Object

Format an exception message



33
34
35
36
# File 'lib/creeper/out_logger.rb', line 33

def format_exception(exception)
  str = "#{exception.class}: #{exception.to_s}\n"
  str << exception.backtrace.join("\n")
end

#info(string) ⇒ Object

Send a info message



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

def info(string)
  Creeper.out_logger.info(string) if Creeper.out_logger
end

#warn(string) ⇒ Object

Send a warning message



17
18
19
# File 'lib/creeper/out_logger.rb', line 17

def warn(string)
  Creeper.out_logger.warn(string) if Creeper.out_logger
end