PhysiCell icon indicating copy to clipboard operation
PhysiCell copied to clipboard

Exploring a log file to focus console output

Open drbergman opened this issue 8 months ago • 2 comments

This PR needs feedback before merge

I know I do not pay attention to the console output at startup mostly because it goes by so fast. I barely know what shows up there (Did you know it prints "rulesets" every time it finds a rulesets element?). Warnings are instantly lost and not received by the user. Rulesets not enabled? You'll never know until you check the results. The console scrollback buffer can also be quickly exceeded and lose some of that opening info.

So, I am looking to have a conversation around creating a log file that puts some/most of this info into a log file to allow the user to focus on more critical output. I started with this PR that aggressively swings the pendulum the other way to show what's possible. Hopefully, with feedback, we can find a nice equilibrium.

Some notes of this implementation

  1. this only logs PhysiCell output, not BioFVM (namespace concerns, particularly at startup)
  2. create a standard way to write a PhysiCell warning/error (log_warning and log_error functions)
  3. an optional variable to log_output allows the message to also be printed to std::cout so it is easy for devs to have both!
  4. log_warning and log_error default to printing to console
  5. I don't know how to easily (read: in one line) convert some of the syntax for log_output(std::string message) function signature. Specifically, something like std::cout << a_string_var << " and " << a_char_var << std::endl; so I converted these to log_file << a_string_var << " and " << a_char_var << std::endl; which works but creates inconsistencies
  6. Test it on the template project or else update your Makefile

drbergman avatar Jun 20 '24 13:06 drbergman