Sha256: 5e14ed7f5e71ef827a049c5ab2eed57d6b0e2cdef32d7c92ac4d0c2900c8bbee

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

module Heartcheck
  # A simple Interface to log messages
  class Logger
    # log message with debug level
    #
    # @param message [String] message to log
    # @return [void]
    def self.debug(message)
      logger(:debug, message)
    end

    # log message with info level
    #
    # @param message [String] message to log
    #
    # @return [void]
    def self.info(message)
      logger(:info, message)
    end

    # log message with warn level
    #
    # @param message [String] message to log
    #
    # @return [void]
    def self.warn(message)
      logger(:warn, message)
    end

    # log message with error level
    #
    # @param message [String] message to log
    #
    # @return [void]
    def self.error(message)
      logger(:error, message)
    end

    private

    # Sent the message to Heartcheck logger
    # that you can configure
    #
    # @see Heartcheck.logger
    # @param level [Symbol] the level log
    # @param message [String] message to log
    #
    # @return [void]
    def self.logger(level, message)
      Heartcheck.logger.send(level, "[Heartcheck] #{message}")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
heartcheck-1.0.5 lib/heartcheck/logger.rb
heartcheck-1.0.4 lib/heartcheck/logger.rb
heartcheck-1.0.3 lib/heartcheck/logger.rb
heartcheck-1.0.0 lib/heartcheck/logger.rb