RMI-PACTA / PACTA_analysis

Run the PACTA analysis on EQ & CB portfolios
Other
25 stars 70 forks source link

adapt `write_log()` so that it adapts to interactive or not #581

Open cjyetman opened 2 years ago

cjyetman commented 2 years ago

Adapt the write_log() function so that it properly adapts to the result of interactive(). If interactive() == TRUE, messages should be sent to the console so the user sees them immediately. If interactive() == FALSE, e.g. when running on TM website, messages should be sent to the appropriate log file. Then all warning(), print(), and similar commands should be converted to use write_log() instead.

fyi @AlexAxthelm

AlexAxthelm commented 2 years ago

we might want to consider moving to an actual logging package.

There's a good list in the README for https://github.com/daroczig/logger/

cjyetman commented 2 years ago

I'm very hesitant to add any new dependencies unless there's an extremely good reason and the needed utility can not be easily achieved without it. I just went through an enormous amount of work pruning as many dependencies as possible. It makes a significant difference especially in the build time, run time, test time, file size, maintenance, etc. of the docker image for TM.

See https://www.tinyverse.org for some explanation of why one may want to avoid unnecessary dependencies, and https://www.tidyverse.org/blog/2019/05/itdepends/ for a slightly less hostile version of the same.