MHLib.jl
MHLib.jl copied to clipboard
Logging
In this pull request I have added basic logging functionality to the MHLib package. I have implemented the following high level changes.
- Created a Log.jl file and module. Also implemented a very simple custom logging method
- Moved all printing/logging methods from Schedulers.jl to Log.jl
- Updated the Settings.jl settings_cfg argument table to include an additional parameter --ofile
- Added a logger::AbstractLogger field to the Scheduler struct
- Small bug fix related to double inclusion of --seed and --ifile when using the all_settings_cfgs as an input to parse_settings!()
In detail the logging process works as follows.
- If the user does not set the --ofile argument than no log file is created. Print statements are still sent to stdout as is normal
- If the user does set the --ofile argument then by default a simple logger is created with the get_logger() method. This logger is an instance of the MHLogger type that simply writes the message directly to a file with no additional information.
- If the user overloads the get_logger method than any logger can be returned. This allows for the user to create their own custom loggers that save the solution data in different ways.
Notes:
- No changes were made to the format or content of the output messages
- All tests run and pass
- Unclear how to benchmark the effect on performance. All methods are created with well defined types, so should be type stable.
Dear James, many thanks for this pull request, which I appreciate much! Just give me some time please to look through it, in particular as I currently have a rather full schedule.
No rush, when you have a chance take a look. I can make any changes you recommend.
Thank's for the contribution!