Module: Pwwka::Logging

Constant Summary collapse

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

Instance Method Summary collapse

Instance Method Details

#logf(format, params) ⇒ Object


18
19
20
21
22
23
24
25
26
# File 'lib/pwwka/logging.rb', line 18

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

#loggerObject


6
7
8
# File 'lib/pwwka/logging.rb', line 6

def logger
  Pwwka.configuration.logger
end