Module: Brpoplpush::RedisScript::Logging

Defined in:
lib/brpoplpush/redis_script/logging.rb

Overview

Utility module for reducing the number of uses of logger.

Author:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



9
10
11
# File 'lib/brpoplpush/redis_script/logging.rb', line 9

def self.included(base)
  base.send(:extend, self)
end

Instance Method Details

#log_debug(message_or_exception = nil) {|String, Exception| ... } ⇒ void

This method returns an undefined value.

Logs a message at debug level

Parameters:

  • message_or_exception (String, Exception) (defaults to: nil)

    the message or exception to log

Yields:

  • (String, Exception)

    the message or exception to use for log message



33
34
35
36
# 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) {|String, Exception| ... } ⇒ void

This method returns an undefined value.

Logs a message at error level

Parameters:

  • message_or_exception (String, Exception) (defaults to: nil)

    the message or exception to log

Yields:

  • (String, Exception)

    the message or exception to use for log message



75
76
77
78
# 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) {|String, Exception| ... } ⇒ void

This method returns an undefined value.

Logs a message at fatal level

Parameters:

  • message_or_exception (String, Exception) (defaults to: nil)

    the message or exception to log

Yields:

  • (String, Exception)

    the message or exception to use for log message



89
90
91
92
# 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) {|String, Exception| ... } ⇒ void

This method returns an undefined value.

Logs a message at info level

Parameters:

  • message_or_exception (String, Exception) (defaults to: nil)

    the message or exception to log

Yields:

  • (String, Exception)

    the message or exception to use for log message



47
48
49
50
# 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) {|String, Exception| ... } ⇒ void

This method returns an undefined value.

Logs a message at warn level

Parameters:

  • message_or_exception (String, Exception) (defaults to: nil)

    the message or exception to log

Yields:

  • (String, Exception)

    the message or exception to use for log message



61
62
63
64
# 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

#loggerLogger

A convenience method for using the configured gem logger

Returns:

  • (Logger)

See Also:

  • RedisScript#.logger


20
21
22
# File 'lib/brpoplpush/redis_script/logging.rb', line 20

def logger
  Brpoplpush::RedisScript.logger
end