|
5 | 5 | from apimatic_core.constants.logger_constants import LoggerConstants |
6 | 6 | from apimatic_core.logger.default_logger import ConsoleLogger |
7 | 7 | from apimatic_core.utilities.api_helper import ApiHelper |
8 | | - |
| 8 | +import copy |
9 | 9 |
|
10 | 10 | class ApiLoggingConfiguration: |
11 | 11 |
|
@@ -47,6 +47,14 @@ def __init__(self, logger, log_level, mask_sensitive_headers, |
47 | 47 | self._request_logging_config = request_logging_config |
48 | 48 | self._response_logging_config = response_logging_config |
49 | 49 |
|
| 50 | + def __deepcopy__(self, memo={}): |
| 51 | + return ApiLoggingConfiguration( |
| 52 | + logger=self._logger, |
| 53 | + log_level=self._log_level, |
| 54 | + mask_sensitive_headers=self._mask_sensitive_headers, |
| 55 | + request_logging_config=copy.deepcopy(self._request_logging_config), |
| 56 | + response_logging_config=copy.deepcopy(self._response_logging_config) |
| 57 | + ) |
50 | 58 |
|
51 | 59 | class BaseHttpLoggingConfiguration: |
52 | 60 |
|
@@ -178,6 +186,14 @@ def _filter_excluded_headers(self, headers): |
178 | 186 | extracted_headers[key] = value |
179 | 187 | return extracted_headers |
180 | 188 |
|
| 189 | + def __deepcopy__(self, memo={}): |
| 190 | + return self.__class__( |
| 191 | + log_body=self._log_body, |
| 192 | + log_headers=self._log_headers, |
| 193 | + headers_to_include=copy.deepcopy(self._headers_to_include), |
| 194 | + headers_to_exclude=copy.deepcopy(self._headers_to_exclude), |
| 195 | + headers_to_unmask=copy.deepcopy(self._headers_to_unmask) |
| 196 | + ) |
181 | 197 |
|
182 | 198 | class ApiRequestLoggingConfiguration(BaseHttpLoggingConfiguration): |
183 | 199 |
|
@@ -221,6 +237,15 @@ def get_loggable_url(self, query_url): |
221 | 237 |
|
222 | 238 | return ApiHelper.get_url_without_query(query_url) |
223 | 239 |
|
| 240 | + def __deepcopy__(self, memo={}): |
| 241 | + return ApiRequestLoggingConfiguration( |
| 242 | + log_body=self._log_body, |
| 243 | + log_headers=self._log_headers, |
| 244 | + headers_to_include=copy.deepcopy(self._headers_to_include), |
| 245 | + headers_to_exclude=copy.deepcopy(self._headers_to_exclude), |
| 246 | + headers_to_unmask=copy.deepcopy(self._headers_to_unmask), |
| 247 | + include_query_in_path=self._include_query_in_path |
| 248 | + ) |
224 | 249 |
|
225 | 250 | class ApiResponseLoggingConfiguration(BaseHttpLoggingConfiguration): |
226 | 251 |
|
|
0 commit comments