class AdLocalize::AdLogger

Public Class Methods

new() click to toggle source
# File lib/ad_localize/ad_logger.rb, line 3
def initialize
  @logger = Logger.new(STDOUT)
  @logger.level = Logger::INFO
end

Public Instance Methods

close() click to toggle source
# File lib/ad_localize/ad_logger.rb, line 36
def close
  @logger.close
end
debug(text) click to toggle source
# File lib/ad_localize/ad_logger.rb, line 20
def debug(text)
  log(level: Logger::DEBUG, text: text)
end
debug!() click to toggle source
# File lib/ad_localize/ad_logger.rb, line 28
def debug!
  @logger.level = Logger::DEBUG
end
debug?() click to toggle source
# File lib/ad_localize/ad_logger.rb, line 32
def debug?
  @logger.debug?
end
error(text) click to toggle source
# File lib/ad_localize/ad_logger.rb, line 16
def error(text)
  log(level: Logger::ERROR, text: text.red)
end
info(text) click to toggle source
# File lib/ad_localize/ad_logger.rb, line 12
def info(text)
  log(level: Logger::INFO, text: text.blue)
end
info!() click to toggle source
# File lib/ad_localize/ad_logger.rb, line 24
def info!
  @logger.level = Logger::INFO
end
warn(text) click to toggle source
# File lib/ad_localize/ad_logger.rb, line 8
def warn(text)
  log(level: Logger::WARN, text: text.yellow)
end

Private Instance Methods

log(level:, text:) click to toggle source
# File lib/ad_localize/ad_logger.rb, line 42
def log(level:, text:)
  @logger.add(level, text)
end