Module: SidekiqUniqueJobs::Logging

Included in:
Client::Middleware, Digests, SidekiqUniqueJobs::Lock::BaseLock, OnConflict::Log, OnConflict::Strategy, UniqueArgs, Util
Defined in:
lib/sidekiq_unique_jobs/logging.rb

Overview

Utility module for reducing the number of uses of logger.

Instance Method Summary collapse

Instance Method Details

#log_debug(message_or_exception = nil) { ... } ⇒ Object

Logs a message at debug level

Parameters:

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

    the message or exception to log

Yields:

  • the message or exception to use for log message Used for compatibility with logger



17
18
19
# File 'lib/sidekiq_unique_jobs/logging.rb', line 17

def log_debug(message_or_exception = nil, &block)
  logger.debug(message_or_exception, &block)
end

#log_error(message_or_exception = nil) { ... } ⇒ Object

Logs a message at error level

Parameters:

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

    the message or exception to log

Yields:

  • the message or exception to use for log message Used for compatibility with logger



41
42
43
# File 'lib/sidekiq_unique_jobs/logging.rb', line 41

def log_error(message_or_exception = nil, &block)
  logger.error(message_or_exception, &block)
end

#log_fatal(message_or_exception = nil) { ... } ⇒ Object

Logs a message at fatal level

Parameters:

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

    the message or exception to log

Yields:

  • the message or exception to use for log message Used for compatibility with logger



49
50
51
# File 'lib/sidekiq_unique_jobs/logging.rb', line 49

def log_fatal(message_or_exception = nil, &block)
  logger.fatal(message_or_exception, &block)
end

#log_info(message_or_exception = nil) { ... } ⇒ Object

Logs a message at info level

Parameters:

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

    the message or exception to log

Yields:

  • the message or exception to use for log message Used for compatibility with logger



25
26
27
# File 'lib/sidekiq_unique_jobs/logging.rb', line 25

def log_info(message_or_exception = nil, &block)
  logger.info(message_or_exception, &block)
end

#log_warn(message_or_exception = nil) { ... } ⇒ Object

Logs a message at warn level

Parameters:

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

    the message or exception to log

Yields:

  • the message or exception to use for log message Used for compatibility with logger



33
34
35
# File 'lib/sidekiq_unique_jobs/logging.rb', line 33

def log_warn(message_or_exception = nil, &block)
  logger.warn(message_or_exception, &block)
end

#loggerObject

A convenience method for using the configured logger



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

def logger
  SidekiqUniqueJobs.logger
end