Module: OnlyofficeBugzillaHelper::LoggerWrapper

Included in:
BugzillaHelper
Defined in:
lib/onlyoffice_bugzilla_helper/logger_wrapper.rb

Overview

Logger module for logging stuff

Instance Method Summary collapse

Instance Method Details

#hide_keys(string) ⇒ String

Hide sensitive info

Parameters:

  • string (String)

    to hide

Returns:

  • (String)

    result



28
29
30
# File 'lib/onlyoffice_bugzilla_helper/logger_wrapper.rb', line 28

def hide_keys(string)
  string&.gsub(@key, '[REMOVED]')
end

#log_request(request, response) ⇒ nil

Log info about request

Parameters:

  • request (Net:HTTP)

    to make

  • response (Net:HTTP)

    in result

Returns:

  • (nil)


17
18
19
20
21
22
23
# 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

#loggerLogger

Returns default logger.

Returns:

  • (Logger)

    default logger



9
10
11
# File 'lib/onlyoffice_bugzilla_helper/logger_wrapper.rb', line 9

def logger
  @logger ||= Logger.new($stdout)
end