Module: Acmaker::Logger::Helper

Included in:
Client, Driver
Defined in:
lib/acmaker/logger.rb

Instance Method Summary collapse

Instance Method Details

#log(level, message, log_options = {}) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/acmaker/logger.rb', line 20

def log(level, message, log_options = {})
  global_option = @options || {}
  message = "[#{level.to_s.upcase}] #{message}" unless level == :info
  message << ' (dry-run)' if global_option[:dry_run]
  message = message.send(log_options[:color]) if log_options[:color]
  logger = global_option[:logger] || Acmaker::Logger.instance
  logger.send(level, message)
end