Skip to content

Commit

Permalink
Pass params into logger.{info,debug} (#913)
Browse files Browse the repository at this point in the history
* Pass params into logger.{info,debug}
  • Loading branch information
richardm-stripe committed Jan 30, 2023
1 parent 9cd91ae commit c45cc1d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions stripe/util.py
Expand Up @@ -53,14 +53,14 @@ def log_debug(message, **params):
msg = logfmt(dict(message=message, **params))
if _console_log_level() == "debug":
print(msg, file=sys.stderr)
logger.debug(msg)
logger.debug(msg, params)


def log_info(message, **params):
msg = logfmt(dict(message=message, **params))
if _console_log_level() in ["debug", "info"]:
print(msg, file=sys.stderr)
logger.info(msg)
logger.info(msg, params)


def _test_or_live_environment():
Expand Down
4 changes: 3 additions & 1 deletion tests/test_util.py
Expand Up @@ -65,7 +65,9 @@ def log_test_loop(self, test_cases, logging_func, logger_name, mocker):
)
else:
print_mock.assert_not_called()
logger_mock.assert_called_once_with("message='foo \\nbar' y=3")
logger_mock.assert_called_once_with(
"message='foo \\nbar' y=3", {"y": 3}
)
finally:
mocker.stopall()

Expand Down

0 comments on commit c45cc1d

Please sign in to comment.