Skip to content

Commit 1e8280d

Browse files
author
Elpedio Adoptante Jr
committed
Update for trace linking
1 parent c6bcfb3 commit 1e8280d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

stackify/log.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@
1010

1111
# the "message" attribute is saved on the record object by a Formatter
1212
RECORD_VARS.add('message')
13+
RECORD_VARS.add('trans_id')
14+
RECORD_VARS.add('log_id')
1315

1416

1517
class LogMsg(JSONObject):
1618
def __init__(self):
19+
self.ID = None
1720
self.Msg = None
1821
self.data = None
1922
self.Ex = None # a StackifyError object
@@ -25,10 +28,12 @@ def __init__(self):
2528
self.SrcLine = None
2629

2730
def from_record(self, record):
31+
self.ID = hasattr(record, 'log_id') and record.log_id or None
2832
self.Msg = record.getMessage()
2933
self.Th = record.threadName or record.thread
3034
self.EpochMs = int(record.created * 1000)
3135
self.Level = record.levelname
36+
self.TransID = hasattr(record, 'trans_id') and record.trans_id or None
3237
self.SrcMethod = record.funcName
3338
self.SrcLine = record.lineno
3439

tests/test_http.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ def test_send_log_group(self):
133133
self.assertEqual(group.CDID, client.device_id)
134134
self.assertEqual(group.CDAppID, client.device_app_id)
135135
self.assertEqual(group.AppNameID, client.app_name_id)
136-
self.assertEqual(group.ServerName, client.device_alias)
137136

138137
@patch('requests.post')
139138
def test_post_arguments(self, post):

0 commit comments

Comments
 (0)