Class: PaypalServerSdk::LoggingConfiguration

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

Overview

Initializes a new instance of LoggingConfiguration.

Instance Method Summary collapse

Constructor Details

#initialize(logger: nil, log_level: nil, mask_sensitive_headers: true, request_logging_config: nil, response_logging_config: nil) ⇒ LoggingConfiguration

Returns a new instance of LoggingConfiguration.

Parameters:

  • logger (LoggerInterface) (defaults to: nil)

    The logger to use for logging messages.

  • log_level (LogLevel) (defaults to: nil)

    The log level to determine which messages should be logged.

  • request_logging_config (RequestLoggingConfiguration) (defaults to: nil)

    Options for logging HTTP requests.

  • response_logging_config (ResponseLoggingConfiguration) (defaults to: nil)

    Options for logging HTTP responses.

  • mask_sensitive_headers (Boolean) (defaults to: true)

    Indicates whether sensitive headers should be masked in logged messages.



86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/paypal_server_sdk/logging/configuration/api_logging_configuration.rb', line 86

def initialize(logger: nil, log_level: nil, mask_sensitive_headers: true,
               request_logging_config: nil,
               response_logging_config: nil)
  request_logging_config ||= RequestLoggingConfiguration.new
  response_logging_config ||= ResponseLoggingConfiguration.new
  super(
    logger,
    log_level,
    request_logging_config,
    response_logging_config,
    mask_sensitive_headers
  )
end

Instance Method Details

#clone_with(logger: nil, log_level: nil, mask_sensitive_headers: nil, request_logging_config: nil, response_logging_config: nil) ⇒ Object



100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/paypal_server_sdk/logging/configuration/api_logging_configuration.rb', line 100

def clone_with(logger: nil, log_level: nil, mask_sensitive_headers: nil,
               request_logging_config: nil, response_logging_config: nil)
  logger ||= self.logger
  log_level ||= self.log_level
  mask_sensitive_headers = self.mask_sensitive_headers ||= mask_sensitive_headers
  request_logging_config ||= self.request_logging_config.clone
  response_logging_config ||= self.response_logging_config.clone

  LoggingConfiguration.new(logger: logger, log_level: log_level,
                           mask_sensitive_headers: mask_sensitive_headers,
                           request_logging_config: request_logging_config,
                           response_logging_config: response_logging_config)
end