Module: Navy

Extended by:
Navy
Included in:
Navy
Defined in:
lib/navy.rb,
lib/navy/version.rb

Defined Under Namespace

Modules: Ship, Util Classes: Admiral, Captain, Officer, Orders, Rank, ScopedLogger, Speak

Constant Summary collapse

VERSION =
"1.1.2"

Instance Method Summary collapse

Instance Method Details

#log_error(logger, prefix, exc) ⇒ Object



17
18
19
20
21
22
# File 'lib/navy.rb', line 17

def log_error(logger, prefix, exc)
  message = exc.message
  message = message.dump if /[[:cntrl:]]/ =~ message
  logger.error "#{prefix}: #{message} (#{exc.class})"
  exc.backtrace.each { |line| logger.error(line) }
end

#loggerObject



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

def logger
  @logger ||= Navy::ScopedLogger.new(Logger.new($stderr))
end