Logging¶
- simulation.logger.configure_listener(logfile, start_time)¶
- Configure the main log listener to write out logs complete with time since the beginning of
program execution, the child/main process the log is coming from, etc.
- Parameters
logfile – The log file for the logger
start_time – The start time since execution
Returns: None
- simulation.logger.log_listener_process(queue, logfile, start_time)¶
- Defines a logging listener process to listen for log messages coming through a multiprocessing
queue.
- Parameters
queue – The multiprocessing queue where log messages are put by main/child processes
logfile – The file to write out logs to
start_time – The execution start time of the listener, to allow for track timestamps of messages
Returns: None
- simulation.logger.truncate_utf8_chars(filename, count, ignore_newlines=True)¶
- Truncates last count characters of a text file encoded in UTF-8/ASCII. Used to edit the JSON
metadata log file in the end into legitimate JSON formatting.
- Parameters
filename – The path to the text file to read
count – Number of UTF-8 characters to remove from the end of the file
ignore_newlines – Set to true, if the newline character at the end of the file should be ignored
- simulation.logger.metadata_log_listener_process(queue, logfile)¶
- Defines a logging listener process for the metadata queue, compiling messages (which should be
a Simulation metadata object) into a JSON file.
- Parameters
queue – The multiprocessing queue where metadata log messages are put
logfile – The JSON file to compile the metadata into
Returns: None