Since I open sourced MagicMirror², I have received many awesome pull requests adding a lot of nice features to the Magic Mirror core. I am very grateful for that! Unfortunately, this comes with a downside: the application gets a lot more complicated.
I started an issue on GitHub to discuss the idea of simplifying the core of MagicMirror². Please let me know what you think! (Preferably in that issue).
I just want to add, that using pm2 flush in a script (for restart purposes) may not work as expected. The next operation will start immediately, before flush completes, and thus the new thread will already start writing to the file, blocking it from getting cleared.
You need to wait for the entire thread to finish, like this: