Class: WordsApi::RequestLoggingConfiguration

Inherits:
CoreLibrary::ApiRequestLoggingConfiguration
  • Object
show all
Defined in:
lib/words_api/logging/configuration/api_logging_configuration.rb

Overview

Initializes a new instance of RequestLoggingConfiguration.

Instance Method Summary collapse

Constructor Details

#initialize(log_body: false, log_headers: false, headers_to_include: nil, headers_to_exclude: nil, headers_to_unmask: nil, include_query_in_path: false) ⇒ RequestLoggingConfiguration

Returns a new instance of RequestLoggingConfiguration.

Parameters:

  • log_body (Boolean) (defaults to: false)

    Indicates whether the message body should be logged. Default is false.

  • log_headers (Boolean) (defaults to: false)

    Indicates whether the message headers should be logged. Default is false.

  • headers_to_exclude (Array<String>) (defaults to: nil)

    Array of headers not displayed in logging. Default is an empty array.

  • headers_to_include (Array<String>) (defaults to: nil)

    Array of headers to be displayed in logging. Default is an empty array.

  • headers_to_unmask (Array<String>) (defaults to: nil)

    Array of headers which values are non-sensitive to display in logging. Default is an empty array.



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/words_api/logging/configuration/api_logging_configuration.rb', line 15

def initialize(log_body: false, log_headers: false, headers_to_include: nil,
               headers_to_exclude: nil, headers_to_unmask: nil,
               include_query_in_path: false)
  super(
    log_body,
    log_headers,
    headers_to_exclude,
    headers_to_include,
    headers_to_unmask,
    include_query_in_path
  )
end

Instance Method Details

#clone_with(log_body: nil, log_headers: nil, headers_to_include: nil, headers_to_exclude: nil, headers_to_unmask: nil, include_query_in_path: nil) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/words_api/logging/configuration/api_logging_configuration.rb', line 28

def clone_with(log_body: nil, log_headers: nil, headers_to_include: nil,
               headers_to_exclude: nil, headers_to_unmask: nil, include_query_in_path: nil)
  log_body ||= self.log_body
  log_headers ||= self.log_headers
  headers_to_include ||= self.headers_to_include
  headers_to_exclude ||= self.headers_to_exclude
  headers_to_unmask ||= self.headers_to_unmask
  include_query_in_path ||= self.include_query_in_path

  RequestLoggingConfiguration.class.new(log_body: log_body, log_headers: log_headers,
                                        headers_to_include: headers_to_include,
                                        headers_to_exclude: headers_to_exclude,
                                        headers_to_unmask: headers_to_unmask,
                                        include_query_in_path: include_query_in_path)
end