Module: Ubea::Log

Defined in:
lib/ubea/log.rb

Class Method Summary collapse

Class Method Details

.debug(message, options = {}) ⇒ Object



18
19
20
# File 'lib/ubea/log.rb', line 18

def debug(message, options = {})
  info message, options if Ubea.config.debug
end

.info(message, options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/ubea/log.rb', line 7

def info(message, options = {})
  options = {
    output: $stdout,
    timestamp: true
  }.merge(options)

  message = "#{Time.now} #{message}" if options.fetch(:timestamp)

  @semaphore.synchronize { options.fetch(:output).puts message }
end

.warn(message, options = {}) ⇒ Object



22
23
24
25
26
# File 'lib/ubea/log.rb', line 22

def warn(message, options = {})
  options = { output: $stderr }.merge(options)

  info "[WARN] #{message}", options
end