Sha256: b1ea6ad3a12d3e9ba93d6fbbb71276e9830dc9758a4e30b988bb1b71d157a735

Contents?: true

Size: 621 Bytes

Versions: 23

Compression:

Stored size: 621 Bytes

Contents

module Pwwka
  module Logging

    delegate :fatal, :error, :warn, :info, :debug, to: :logger

    def logger
      Pwwka.configuration.logger
    end

    LEVELS = {
      fatal: 5,
      error: 4,
      warn: 3,
      info: 2,
      debug: 1,
    }

    def logf(format,params)
      level = params.delete(:at) || Pwwka.configuration.log_level
      params[:payload] = params["payload"] if params["payload"]
      if Pwwka.configuration.omit_payload_from_log?(level)
        params[:payload] = "[omitted]" if params[:payload]
      end
      message = format % params
      logger.send(level,message)
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
pwwka-0.19.0 lib/pwwka/logging.rb
pwwka-0.18.0 lib/pwwka/logging.rb
pwwka-0.17.0 lib/pwwka/logging.rb