Module: BBK::Utils

Defined in:
lib/bbk/utils.rb,
lib/bbk/utils/xml.rb,
lib/bbk/utils/crypt.rb,
lib/bbk/utils/config.rb,
lib/bbk/utils/logger.rb,
lib/bbk/utils/version.rb,
lib/bbk/utils/env_helper.rb,
lib/bbk/utils/proxy_logger.rb,
lib/bbk/utils/log_formatter.rb,
lib/bbk/utils/combined_logger.rb

Defined Under Namespace

Modules: EnvHelper, Xml Classes: CombinedLogger, Config, Crypt, LogFormatter, Logger, ProxyLogger

Constant Summary collapse

VERSION =
'1.1.1'.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.loggerObject

Returns the value of attribute logger.



19
20
21
# File 'lib/bbk/utils.rb', line 19

def logger
  @logger
end

Class Method Details

.gracefully_mainObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/bbk/utils.rb', line 21

def gracefully_main
  yield
  0
rescue SignalException => e
  if %w[INT TERM EXIT QUIT].include?(Signal.signame(e.signo))
    0
  else
    logger.error "Signal: #{e.inspect}"
    1
  end
rescue StandardError => e
  logger.error "Exception: #{e.inspect}. Backtrace: #{e.backtrace.inspect}"
  1
rescue SystemExit => e
  logger.error "System exit: #{e.inspect}. Backtrace: #{e.backtrace.inspect}"
  e.status
end