@@ -230,18 +230,12 @@ def test_log_exc_info_false(self):
230
230
def test_log_record_exception_with_object_payload (self ):
231
231
processor , logger = set_up_test_logging (logging .ERROR )
232
232
233
- class CustomObject :
234
- pass
235
-
236
233
class CustomException (Exception ):
237
- def __init__ (self , data ):
238
- self .data = data
239
-
240
234
def __str__ (self ):
241
235
return "CustomException stringified"
242
236
243
237
try :
244
- raise CustomException (CustomObject () )
238
+ raise CustomException ("CustomException message" )
245
239
except CustomException as exception :
246
240
with self .assertLogs (level = logging .ERROR ):
247
241
logger .exception (exception )
@@ -255,17 +249,16 @@ def __str__(self):
255
249
log_record .attributes [SpanAttributes .EXCEPTION_TYPE ],
256
250
CustomException .__name__ ,
257
251
)
258
- self .assertTrue (
259
- "<tests.logs.test_handler.TestLoggingHandler.test_log_record_exception_with_object_payload.<locals>.CustomObject"
260
- in log_record . attributes [ SpanAttributes . EXCEPTION_MESSAGE ]
252
+ self .assertEqual (
253
+ log_record . attributes [ SpanAttributes . EXCEPTION_MESSAGE ],
254
+ "CustomException message" ,
261
255
)
262
256
stack_trace = log_record .attributes [
263
257
SpanAttributes .EXCEPTION_STACKTRACE
264
258
]
265
259
self .assertIsInstance (stack_trace , str )
266
260
self .assertTrue ("Traceback" in stack_trace )
267
261
self .assertTrue ("CustomException" in stack_trace )
268
- self .assertTrue ("CustomObject" in stack_trace )
269
262
self .assertTrue (__file__ in stack_trace )
270
263
271
264
def test_log_record_trace_correlation (self ):
0 commit comments