diff --git a/src/azul/chalice.py b/src/azul/chalice.py index 381053c67..af6b8e2f1 100644 --- a/src/azul/chalice.py +++ b/src/azul/chalice.py @@ -414,16 +414,15 @@ def _log_request(self): body = self.current_request.json_body if body is None: - body_len_msg = '' + len_msg = '' elif config.debug == 2: body = json.dumps(body, cls=self._LogJSONEncoder) - body_len_msg = f' ({len(body)} characters)' + len_msg = f' ({len(body)} characters)' else: n = 1024 - body_len_msg = f' (first {str(n)} characters)' + len_msg = f' (first {str(n)} characters)' body = json_head(n, body) if not isinstance(body, str | bytes) else body[:n] - log.info('%s%s', - http_body_log_message('request', body, verbatim=True), body_len_msg) + log.info('%s', http_body_log_message('request', body, verbatim=True) + len_msg) def _log_response(self, response): if log.isEnabledFor(logging.DEBUG):