summaryrefslogtreecommitdiff
path: root/esds/simulator.py
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-09-09 17:51:37 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2022-09-09 17:51:37 +0200
commitbc4ce548db258f79f0841def89f1a70316cef43d (patch)
tree159cd59a5dd6371d311c43a4a44381c146ef3dc0 /esds/simulator.py
parentc4509c7a26391977ad01aa958b343e3fab1ffd02 (diff)
Improve debug
Diffstat (limited to 'esds/simulator.py')
-rw-r--r--esds/simulator.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/esds/simulator.py b/esds/simulator.py
index 2ea77b9..fb52fec 100644
--- a/esds/simulator.py
+++ b/esds/simulator.py
@@ -50,6 +50,7 @@ class Simulator:
self.interferences=True
self.wait_end_nodes=list() # Keep track of nodes that wait for the end of the simulation
self.time_truncated=format(self.time,self.precision) # Truncated version is used in log print
+ self.debug=None # No debug by default
def update_network(self,netmat):
for event in self.events:
@@ -85,7 +86,10 @@ class Simulator:
def log(self,msg,node=None):
src = "esds" if node is None else "n"+str(node)
- print("[t="+str(self.time_truncated)+",src="+src+"] "+msg)
+ logline="[t="+str(self.time_truncated)+",src="+src+"] "+msg
+ if self.debug is not None:
+ self.debug.append_log(logline)
+ print(logline)
def sort_events(self):
"""