module Brpoplpush::RedisScript::Logging

Utility module for reducing the number of uses of logger.

@author Mikael Henriksson <mikael@mhenrixon.com>

Public Class Methods

included(base) click to toggle source
# File lib/brpoplpush/redis_script/logging.rb, line 9
def self.included(base)
  base.send(:extend, self)
end

Public Instance Methods

log_debug(message_or_exception = nil, &block) click to toggle source

Logs a message at debug level

@param [String, Exception] message_or_exception the message or exception to log

@return [void]

@yield [String, Exception] the message or exception to use for log message

# File lib/brpoplpush/redis_script/logging.rb, line 33
def log_debug(message_or_exception = nil, &block)
  logger.debug(message_or_exception, &block)
  nil
end
log_error(message_or_exception = nil, &block) click to toggle source

Logs a message at error level

@param [String, Exception] message_or_exception the message or exception to log

@return [void]

@yield [String, Exception] the message or exception to use for log message

# File lib/brpoplpush/redis_script/logging.rb, line 75
def log_error(message_or_exception = nil, &block)
  logger.error(message_or_exception, &block)
  nil
end
log_fatal(message_or_exception = nil, &block) click to toggle source

Logs a message at fatal level

@param [String, Exception] message_or_exception the message or exception to log

@return [void]

@yield [String, Exception] the message or exception to use for log message

# File lib/brpoplpush/redis_script/logging.rb, line 89
def log_fatal(message_or_exception = nil, &block)
  logger.fatal(message_or_exception, &block)
  nil
end
log_info(message_or_exception = nil, &block) click to toggle source

Logs a message at info level

@param [String, Exception] message_or_exception the message or exception to log

@return [void]

@yield [String, Exception] the message or exception to use for log message

# File lib/brpoplpush/redis_script/logging.rb, line 47
def log_info(message_or_exception = nil, &block)
  logger.info(message_or_exception, &block)
  nil
end
log_warn(message_or_exception = nil, &block) click to toggle source

Logs a message at warn level

@param [String, Exception] message_or_exception the message or exception to log

@return [void]

@yield [String, Exception] the message or exception to use for log message

# File lib/brpoplpush/redis_script/logging.rb, line 61
def log_warn(message_or_exception = nil, &block)
  logger.warn(message_or_exception, &block)
  nil
end
logger() click to toggle source

A convenience method for using the configured gem logger

@see RedisScript#.logger

@return [Logger]

# File lib/brpoplpush/redis_script/logging.rb, line 20
def logger
  Brpoplpush::RedisScript.logger
end