Logging operation data to memory WP77

We will start developing a small app to save operational data to memory (CELL network off) and then to play them back so to log data to the server once the modem reconnect.
The intention is to use a set of C functions we have used in the past, saving a struct to memory appended to a file, this will include a CRC field for data validation.
The only concern we have is to prevent the writing in case of low supply of the unit, which may cause data corruption, is there any anyone who has done this before?
Any hint on other possible issues we should handle is appreciated.
Thanks

You can check the battery voltage before writing the flash