Skip to content

make non-ascii characters in logger messages legible #203

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

Merged
merged 1 commit into from
May 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/firebase_functions/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ def _entry_from_args(severity: LogSeverity, *args, **kwargs) -> LogEntry:
"""

message: str = " ".join([
value
if isinstance(value, str) else _json.dumps(_remove_circular(value))
for value in args
value if isinstance(value, str) else _json.dumps(
_remove_circular(value), ensure_ascii=False) for value in args
])

other: _typing.Dict[str, _typing.Any] = {
Expand Down Expand Up @@ -95,7 +94,8 @@ def _get_write_file(severity: LogSeverity) -> _typing.TextIO:

def write(entry: LogEntry) -> None:
write_file = _get_write_file(entry["severity"])
print(_json.dumps(_remove_circular(entry)), file=write_file)
print(_json.dumps(_remove_circular(entry), ensure_ascii=False),
file=write_file)


def debug(*args, **kwargs) -> None:
Expand Down
Loading