LDAR-Sim / LDAR_Sim

MIT License
11 stars 20 forks source link

Ldar 87 ldar sim error logging #288

Closed ThomasGalesloot closed 1 month ago

ThomasGalesloot commented 1 month ago

Pull Request Key Information

Reason for change

LDAR-Sim currently prints all simulation info, warnings and error messages to the console. This can be problematic when running longer simulations or when rerunning a simulation as important messages can get "lost".

What was changed

Added logging for error messages. Messages are still printed to the console, but also logged to 2 log files. 1 log file will be a timestamped file in a "Logs" folder in the high level LDAR-Sim directory. The other will be a log file in a "Logs" folder in the output directory.

Console Error: image

Error in log file: image

Timestamped Log File: image

Log File in outputs: image

Timestamp Logs folder location: image

Outputs Logs folder location: image

Intended Purpose

Log error messages to a file in addition to printing them to the terminal.

Level of version change required

Patch.

Testing Completed

Manual testing to ensure log files are properly created and populated. Manually ran simulation without errors to completion, ensure visualizations looked as expected.

All unit tests pass: unit_test_results.txt

All end-to-end tests pass: V4-simple_repairable_emissions_3209061d47964dd38b1c0802f5ced8f93442efff.log V4_simple_non_repairable_emissions_3209061d47964dd38b1c0802f5ced8f93442efff.log

Target Issue

N/A

Additional Information

N/A

ThomasGalesloot commented 1 month ago

Great job.

While it's set up such that the logging and console print can be turned off, the code itself is always set to log and print to console. Is this intentional?

Yes this is intentional. There is the intention to connect the boolean values to simulation setting level parameters in a later commit.