Skip to content

Commit

Permalink
Refactor log masking logic in client API
Browse files Browse the repository at this point in the history
Renamed the variable `should_logs_masking` to `should_mask_logs` and updated its condition for better readability and understanding in core client API. This variable is used to determine if logs should be masked or not based on the effective logging level. This change is crucial for managing logs' visibility and enhancing overall system security.
  • Loading branch information
Omar Al-Jarrah committed Nov 6, 2023
1 parent 6e0e447 commit 49bccec
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions expediagroup/sdk/core/client/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ def call(
timeout=self.request_timeout,
)

should_logs_masking: bool = LOG.getEffectiveLevel() > logging.DEBUG or LOG.getEffectiveLevel() == logging
should_mask_logs: bool = LOG.getEffectiveLevel() > logging.DEBUG or LOG.getEffectiveLevel() == logging.NOTSET

logged_body: Union[dict, str, None] = None
if body:
logged_body = str(body.dict()) if should_logs_masking else json.loads(body.json())
logged_body = str(body.dict()) if should_mask_logs else json.loads(body.json())

request_log_message = log_util.request_log(
headers=request_headers,
Expand Down

0 comments on commit 49bccec

Please sign in to comment.