Skip to content

Commit c87082e

Browse files
committed
Better message print for Database messages
1 parent 73a60ad commit c87082e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

mocha_core/mocha_core/database.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,15 @@ def __eq__(self, other):
6868
return True
6969

7070
def __str__(self):
71-
return "%d, %d, %d, %d, %f" % (self.robot_id, self.topic_id,
72-
self.dtype, self.priority,
73-
self.ts.nanoseconds)
71+
string = f"----- Database Message -----\n"
72+
string += f"Robot ID: {self.robot_id}\n"
73+
string += f"Topic ID: {self.topic_id}\n"
74+
string += f"Data type: {self.dtype}\n"
75+
string += f"Priority: {self.priority}\n"
76+
string += f"Timestamp (ns): {self.ts.nanoseconds}\n"
77+
string += f"Binary data: {self.data}\n"
78+
string += f"----------------------------"
79+
return string
7480

7581

7682
class DBwLock():

0 commit comments

Comments
 (0)