-1

I want to create a log file to store all the events that occur during the course of my simulation (possibly with timestamp) in Simpy. How can I do this?

desertnaut
  • 57,590
  • 26
  • 140
  • 166

1 Answers1

0

can you just box the yield statements with print / log statements? In many ways this is the easiest and it allows you to add context data, i.e. who is creating the event. Python has a built in logging lib called logging. The other options are to dynamically monkey patch the event classes or sub class the event classes. I myself just box the yield statements with logging. I think this is the clearest way to know what is getting logged and I do not have maintain any sub classes.

Michael
  • 1,671
  • 2
  • 4
  • 8