| 66 | } |
| 67 | |
| 68 | std::string getLastLogs() { |
| 69 | if (rtcLogMagic != LOG_RTC_MAGIC) { |
| 70 | return {}; |
| 71 | } |
| 72 | std::string output; |
| 73 | for (size_t i = 0; i < MAX_LOG_LINES; i++) { |
| 74 | size_t idx = (logHead + i) % MAX_LOG_LINES; |
| 75 | if (logMessages[idx][0] != '\0') { |
| 76 | const size_t len = strnlen(logMessages[idx], MAX_ENTRY_LEN); |
| 77 | output.append(logMessages[idx], len); |
| 78 | } |
| 79 | } |
| 80 | return output; |
| 81 | } |
| 82 | |
| 83 | // Checks whether the RTC log state is consistent: rtcLogMagic must equal |
| 84 | // LOG_RTC_MAGIC and logHead must be in 0..MAX_LOG_LINES-1. Returns true if |