diff --git a/host/esp-t-sim7000g/src/main.cpp b/host/esp-t-sim7000g/src/main.cpp index 542d10a08092a2ce58d51b574ec553c6e9190b21..764990715537ec74267b1311658f982535a58e6b 100644 --- a/host/esp-t-sim7000g/src/main.cpp +++ b/host/esp-t-sim7000g/src/main.cpp @@ -83,17 +83,20 @@ int vprintf_into_sd(const char *szFormat, va_list args) // write evaluated format string into buffer int ret = vsnprintf(log_print_buffer, sizeof(log_print_buffer), logstring.c_str(), args); + String date = rtc.getDate(); + String filename = "/log_" + date + ".txt"; + // output is now in buffer. write to file. if (ret >= 0) { - if (!SD.exists("/log.txt")) { - File writeLog = SD.open("/log.txt", FILE_WRITE); + if (!SD.exists(filename)) { + File writeLog = SD.open(filename, FILE_WRITE); if (!writeLog) - Serial.println("Couldn't open spiffs_log.txt"); + Serial.println("Couldn't open " + filename + " for writing"); delay(50); writeLog.close(); } - File logFile = SD.open("/log.txt", FILE_APPEND); + File logFile = SD.open(filename, FILE_APPEND); // debug output vprintf(logstring.c_str(), args);