Skip to content

Logging

Jens Engel edited this page Jan 30, 2021 · 1 revision

The logging interface in PARODIS is kept simple and straight-forward. There is a global simulation log and one seperate log for each agent that is executed. All messages that are logged to the agent log are also logged to the global log, prefixed with the agent from which it stems. All log messages are logged live into the log files.

During the simulation, the output to the MATLAB console window is minimal (if solver verbosity is turned off). To get a more verbose view of what is going on, it can make sense to tail -f the log files.

All log files are created once the simulation starts. If the log files already exist (because a simulation is re-run), the pre-existing log-files will be overwritten. The global log file resides in Results/%simulation_name%/log.txt, and the agent log files in Results/%simulation_name%/%agent_name%/log.txt respectively.

The logging interface can also be used in user-defined callbacks, in order to log any necessary information. Both the Simulation and Agent classes possess a log method. This method can receive 2 arguments:

[] = simulation/agent.log(message, [display = false])

The message should be a string with the message to be logged. A message will automatically be prefixed with the time at which it was logged. If the optional argument display is set to true, the message will also be printed to the MATLAB console output.

Using the log method of the Simulation class will log into the global simulation log, while the Agent method will log both into the agent's local log and the global simulation log, prefixed with the agent's name.