Merge branch 'arendst:development' into patch-2

This commit is contained in:
Jason2866 2021-05-31 19:56:02 +02:00
commit 62753de6ae
1 changed files with 4 additions and 1 deletions

View File

@ -2307,6 +2307,9 @@ void AddLogData(uint32_t loglevel, const char* log_data) {
Serial.printf("%s%s\r\n", mxtime, log_data);
}
uint32_t log_data_len = strlen(log_data) + strlen(mxtime) + 4; // 4 = log_buffer_pointer + '\1' + '\0'
if (log_data_len > LOG_BUFFER_SIZE) { return; } // log_data too big for buffer - discard logging
uint32_t highest_loglevel = Settings.weblog_level;
if (Settings.mqttlog_level > highest_loglevel) { highest_loglevel = Settings.mqttlog_level; }
if (TasmotaGlobal.syslog_level > highest_loglevel) { highest_loglevel = TasmotaGlobal.syslog_level; }
@ -2322,7 +2325,7 @@ void AddLogData(uint32_t loglevel, const char* log_data) {
TasmotaGlobal.log_buffer_pointer++; // Index 0 is not allowed as it is the end of char string
}
while (TasmotaGlobal.log_buffer_pointer == TasmotaGlobal.log_buffer[0] || // If log already holds the next index, remove it
strlen(TasmotaGlobal.log_buffer) + strlen(log_data) + strlen(mxtime) + 4 > LOG_BUFFER_SIZE) // 4 = log_buffer_pointer + '\1' + '\0'
strlen(TasmotaGlobal.log_buffer) + log_data_len > LOG_BUFFER_SIZE)
{
char* it = TasmotaGlobal.log_buffer;
it++; // Skip log_buffer_pointer