Add custom log property to ArrayAnySegment

Introduces a log property to ArrayAnySegment that returns an empty string when the array is empty, instead of '[]'. This improves log output readability for empty arrays.
pull/21938/head
Kalo Chin 10 months ago
parent 824aaeedba
commit 97a9c51d1b

@ -148,6 +148,15 @@ class ArrayAnySegment(ArraySegment):
value_type: SegmentType = SegmentType.ARRAY_ANY
value: Sequence[Any]
@property
def log(self) -> str:
"""
When the array is empty, return an empty string rather than "[]".
"""
if len(self.value) == 0:
return ""
return str(self.value)
class ArrayStringSegment(ArraySegment):
value_type: SegmentType = SegmentType.ARRAY_STRING

Loading…
Cancel
Save