Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3e2b019

Browse files
authored
Add record's __dict__ to structPayload
Not sure if it is not included intentionally... This is a light version of what is done at https://github.com/severb/graypy/blob/master/graypy/handler.py#L97
1 parent 930342a commit 3e2b019

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

gcloud/logging/handlers/transports/background_thread.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,14 @@ def enqueue(self, record, message):
127127
self._entries_condition.acquire()
128128
if self.stopping:
129129
return
130+
record_dict = record.__dict__
131+
for blacklisted in ("args", "msg", "message"):
132+
del record_dict[blacklisted]
133+
exc_info = record_dict["exc_info"]
134+
if exc_info is not None:
135+
record_dict["exc_info"] = str(exc_info[0])
130136
self.batch.log_struct({"message": message,
137+
"record": record_dict,
131138
"python_logger": record.name},
132139
severity=record.levelname)
133140
self._entries_condition.notify()

0 commit comments

Comments
 (0)