Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass params into logger.{info,debug} #913

Merged
merged 3 commits into from Jan 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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