Module: GoFlippy::Logger

Included in:
Client, Config, HttpClient, Poller, Worker
Defined in:
lib/goflippy-ruby/logger.rb

Constant Summary collapse

MESSAGE_PREFIX =
'[GoFippy]'

Class Method Summary collapse

Class Method Details

.debug(message) ⇒ Object



17
18
19
# File 'lib/goflippy-ruby/logger.rb', line 17

def self.debug(message)
  self.logger.debug("#{MESSAGE_PREFIX} #{message}")
end

.error(message) ⇒ Object



29
30
31
# File 'lib/goflippy-ruby/logger.rb', line 29

def self.error(message)
  self.logger.error("#{MESSAGE_PREFIX} #{message}")
end

.fatal(message) ⇒ Object



33
34
35
# File 'lib/goflippy-ruby/logger.rb', line 33

def self.fatal(message)
  self.logger.fatal("#{MESSAGE_PREFIX} #{message}")
end

.info(message) ⇒ Object



21
22
23
# File 'lib/goflippy-ruby/logger.rb', line 21

def self.info(message)
  self.logger.info("#{MESSAGE_PREFIX} #{message}")
end

.loggerObject



7
8
9
10
11
# File 'lib/goflippy-ruby/logger.rb', line 7

def self.logger
  @logger ||= defined?(Rails) && Rails.respond_to?(:logger) ?
                  Rails.logger :
                  ::Logger.new($stdout, level: ::Logger::DEBUG)
end

.logger=(logger) ⇒ Object



13
14
15
# File 'lib/goflippy-ruby/logger.rb', line 13

def self.logger=(logger)
  @logger = logger
end

.unknown(message) ⇒ Object



37
38
39
# File 'lib/goflippy-ruby/logger.rb', line 37

def self.unknown(message)
  self.logger.unknown("#{MESSAGE_PREFIX} #{message}")
end

.warn(message) ⇒ Object



25
26
27
# File 'lib/goflippy-ruby/logger.rb', line 25

def self.warn(message)
  self.logger.warn("#{MESSAGE_PREFIX} #{message}")
end