Skip to content
Permalink
Browse files
feat: Add json setting to allow unicodes to show in log instead of as…
…cii ch… (#193)
  • Loading branch information
ysde committed Mar 15, 2021
1 parent 42bda27 commit e8c8e30fc4f618273dec1415c752eed203c75b67
Showing with 3 additions and 3 deletions.
  1. +1 −1 google/cloud/logging_v2/handlers/_helpers.py
  2. +2 −2 tests/unit/handlers/test_container_engine.py
@@ -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():
@@ -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
)
@@ -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.