Sha256: a9b474a9e902c2a436b2f1898de8f772b4702d392403ad71d58a2b790daecbd4

Contents?: true

Size: 1.11 KB

Versions: 15

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

15 entries across 15 versions & 1 rubygems

Version Path
heartcheck-2.0.0 lib/heartcheck/logger.rb
heartcheck-1.6.0 lib/heartcheck/logger.rb
heartcheck-1.5.1 lib/heartcheck/logger.rb
heartcheck-1.5.0 lib/heartcheck/logger.rb
heartcheck-1.4.0 lib/heartcheck/logger.rb
heartcheck-1.3.0 lib/heartcheck/logger.rb
heartcheck-1.2.2 lib/heartcheck/logger.rb
heartcheck-1.2.1 lib/heartcheck/logger.rb
heartcheck-1.2.0 lib/heartcheck/logger.rb
heartcheck-1.1.1 lib/heartcheck/logger.rb
heartcheck-1.1.0 lib/heartcheck/logger.rb
heartcheck-1.0.9 lib/heartcheck/logger.rb
heartcheck-1.0.8 lib/heartcheck/logger.rb
heartcheck-1.0.7 lib/heartcheck/logger.rb
heartcheck-1.0.6 lib/heartcheck/logger.rb