Skip to content

Commit

Permalink
feat: Add json setting to allow unicodes to show in log instead of as…
Browse files Browse the repository at this point in the history
…cii ch… (#193)
  • Loading branch information
ysde committed Mar 15, 2021
1 parent 42bda27 commit e8c8e30
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion google/cloud/logging_v2/handlers/_helpers.py
Expand Up @@ -48,7 +48,7 @@ def format_stackdriver_json(record, message):
"severity": record.levelname,
}

return json.dumps(payload)
return json.dumps(payload, ensure_ascii=False)


def get_request_data_from_flask():
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/handlers/test_container_engine.py
Expand Up @@ -40,7 +40,7 @@ def test_format(self):

handler = self._make_one()
logname = "loggername"
message = "hello world"
message = "hello world,嗨 世界"
record = logging.LogRecord(
logname, logging.INFO, None, None, message, None, None
)
Expand All @@ -53,4 +53,4 @@ def test_format(self):
}
payload = handler.format(record)

self.assertEqual(payload, json.dumps(expected_payload))
self.assertEqual(payload, json.dumps(expected_payload, ensure_ascii=False))

0 comments on commit e8c8e30

Please sign in to comment.