Sha256: ef52a62f191f9d1085b97e9a240a270d3aa5bf45b93d1020f89595f4a14d8125

Contents?: true

Size: 1.95 KB

Versions: 9

Compression:

Stored size: 1.95 KB

Contents

# frozen_string_literal: true

module SidekiqUniqueJobs
  # Utility module for reducing the number of uses of logger.
  #
  # @author Mikael Henriksson <mikael@zoolutions.se>
  module Logging
    # A convenience method for using the configured logger
    def logger
      SidekiqUniqueJobs.logger
    end

    # Logs a message at debug level
    # @param message_or_exception [String, Exception] the message or exception to log
    # @yield the message or exception to use for log message
    #   Used for compatibility with logger
    def log_debug(message_or_exception = nil, &block)
      logger.debug(message_or_exception, &block)
    end

    # Logs a message at info level
    # @param message_or_exception [String, Exception] the message or exception to log
    # @yield the message or exception to use for log message
    #   Used for compatibility with logger
    def log_info(message_or_exception = nil, &block)
      logger.info(message_or_exception, &block)
    end

    # Logs a message at warn level
    # @param message_or_exception [String, Exception] the message or exception to log
    # @yield the message or exception to use for log message
    #   Used for compatibility with logger
    def log_warn(message_or_exception = nil, &block)
      logger.warn(message_or_exception, &block)
    end

    # Logs a message at error level
    # @param message_or_exception [String, Exception] the message or exception to log
    # @yield the message or exception to use for log message
    #   Used for compatibility with logger
    def log_error(message_or_exception = nil, &block)
      logger.error(message_or_exception, &block)
    end

    # Logs a message at fatal level
    # @param message_or_exception [String, Exception] the message or exception to log
    # @yield the message or exception to use for log message
    #   Used for compatibility with logger
    def log_fatal(message_or_exception = nil, &block)
      logger.fatal(message_or_exception, &block)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
sidekiq-unique-jobs-6.0.6 lib/sidekiq_unique_jobs/logging.rb
sidekiq-unique-jobs-6.0.5 lib/sidekiq_unique_jobs/logging.rb
sidekiq-unique-jobs-6.0.4 lib/sidekiq_unique_jobs/logging.rb
sidekiq-unique-jobs-6.0.3 lib/sidekiq_unique_jobs/logging.rb
sidekiq-unique-jobs-6.0.2 lib/sidekiq_unique_jobs/logging.rb
sidekiq-unique-jobs-6.0.1 lib/sidekiq_unique_jobs/logging.rb
sidekiq-unique-jobs-6.0.0 lib/sidekiq_unique_jobs/logging.rb
sidekiq-unique-jobs-6.0.0.rc8 lib/sidekiq_unique_jobs/logging.rb
sidekiq-unique-jobs-6.0.0.rc7 lib/sidekiq_unique_jobs/logging.rb