module OnlyofficeBugzillaHelper::LoggerWrapper

Logger module for logging stuff

Public Instance Methods

hide_keys(string) click to toggle source

Hide sensitive info @param [String] string to hide @return [String] result

# File lib/onlyoffice_bugzilla_helper/logger_wrapper.rb, line 28
def hide_keys(string)
  string&.gsub(@key, '[REMOVED]')
end
log_request(request, response) click to toggle source

Log info about request @param [Net:HTTP] request to make @param [Net:HTTP] response in result @return [nil]

# File lib/onlyoffice_bugzilla_helper/logger_wrapper.rb, line 17
def log_request(request, response)
  logger.info('Made request. '\
              "Type: #{request.method}. "\
              "Path: #{hide_keys(request.path)}. "\
              "Body: #{hide_keys(request.body)}. "\
              "Response: #{hide_keys(response.body)}")
end
logger() click to toggle source

@return [Logger] default logger

# File lib/onlyoffice_bugzilla_helper/logger_wrapper.rb, line 9
def logger
  @logger ||= Logger.new($stdout)
end