mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-24 03:06:33 +00:00
Comments to longer logging support
This commit is contained in:
parent
322c056758
commit
317483bf09
@ -2198,24 +2198,15 @@ void SyslogAsync(bool refresh) {
|
|||||||
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_SYSLOG_HOST_NOT_FOUND ". " D_RETRY_IN " %d " D_UNIT_SECOND), SYSLOG_TIMER);
|
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_SYSLOG_HOST_NOT_FOUND ". " D_RETRY_IN " %d " D_UNIT_SECOND), SYSLOG_TIMER);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
char log_data[len +72]; // Hostname + Id + log data
|
|
||||||
snprintf_P(log_data, sizeof(log_data), PSTR("%s ESP-"), NetworkHostname());
|
|
||||||
uint32_t preamble_len = strlen(log_data);
|
|
||||||
len -= mxtime;
|
|
||||||
strlcpy(log_data +preamble_len, line +mxtime, len);
|
|
||||||
// wemos5 ESP-HTP: Web server active on wemos5 with IP address 192.168.2.172
|
|
||||||
PortUdp_write(log_data, preamble_len + len);
|
|
||||||
*/
|
|
||||||
String log_data = NetworkHostname();
|
String log_data = NetworkHostname();
|
||||||
log_data += F(" ESP-");
|
log_data += F(" ESP-");
|
||||||
|
|
||||||
// log_data.concat(line +mxtime, len -mxtime -1); // Add terminating \'0'
|
// log_data.concat(line +mxtime, len -mxtime -1); // Add terminating \'0' - Not supported on ESP32
|
||||||
len--;
|
len--;
|
||||||
char dummy = line[len];
|
char save_log_char = line[len];
|
||||||
line[len] = '\0'; // Add terminating \'0'
|
line[len] = '\0'; // Add terminating \'0'
|
||||||
log_data.concat(line +mxtime);
|
log_data.concat(line +mxtime);
|
||||||
line[len] = dummy;
|
line[len] = save_log_char;
|
||||||
|
|
||||||
// wemos5 ESP-HTP: Web server active on wemos5 with IP address 192.168.2.172
|
// wemos5 ESP-HTP: Web server active on wemos5 with IP address 192.168.2.172
|
||||||
PortUdp.write(log_data.c_str());
|
PortUdp.write(log_data.c_str());
|
||||||
|
@ -2848,15 +2848,15 @@ void HandleHttpCommand(void)
|
|||||||
// [14:49:36.123 MQTT: stat/wemos5/RESULT = {"POWER":"OFF"}] > [{"POWER":"OFF"}]
|
// [14:49:36.123 MQTT: stat/wemos5/RESULT = {"POWER":"OFF"}] > [{"POWER":"OFF"}]
|
||||||
char* JSON = (char*)memchr(line, '{', len);
|
char* JSON = (char*)memchr(line, '{', len);
|
||||||
if (JSON) { // Is it a JSON message (and not only [15:26:08 MQT: stat/wemos5/POWER = O])
|
if (JSON) { // Is it a JSON message (and not only [15:26:08 MQT: stat/wemos5/POWER = O])
|
||||||
String stemp = (cflg) ? "," : ""; // Add a comma
|
String stemp = (cflg) ? "," : ""; // Add comma
|
||||||
size_t JSONlen = len - (JSON - line);
|
|
||||||
|
|
||||||
// stemp.concat(JSON +1, JSONlen -3); // Add a terminating '\0'
|
// size_t JSONlen = len - (JSON - line);
|
||||||
len -= 2;
|
// stemp.concat(JSON +1, JSONlen -3); // Add terminating '\0' - Not supported on ESP32
|
||||||
char dummy = line[len];
|
len -= 2; // Skip last '}'
|
||||||
line[len] = '\0'; // Add terminating \'0'
|
char save_log_char = line[len];
|
||||||
stemp.concat(JSON +1);
|
line[len] = '\0'; // Add terminating \'0'
|
||||||
line[len] = dummy;
|
stemp.concat(JSON +1); // Skip first '{'
|
||||||
|
line[len] = save_log_char;
|
||||||
|
|
||||||
Webserver->sendContent(stemp);
|
Webserver->sendContent(stemp);
|
||||||
cflg = true;
|
cflg = true;
|
||||||
@ -2937,13 +2937,15 @@ void HandleConsoleRefresh(void)
|
|||||||
size_t len;
|
size_t len;
|
||||||
WSContentFlush();
|
WSContentFlush();
|
||||||
while (GetLog(Settings.weblog_level, &index, &line, &len)) {
|
while (GetLog(Settings.weblog_level, &index, &line, &len)) {
|
||||||
String stemp = (cflg) ? "\n" : ""; // Add a newline
|
String stemp = (cflg) ? "\n" : ""; // Add newline
|
||||||
|
|
||||||
|
// stemp.concat(line, len -1); // Add terminating '\0' - Not supported on ESP32
|
||||||
len--;
|
len--;
|
||||||
// stemp.concat(line, len); // Add a terminating '\0'
|
char save_log_char = line[len];
|
||||||
char dummy = line[len];
|
|
||||||
line[len] = '\0'; // Add terminating \'0'
|
line[len] = '\0'; // Add terminating \'0'
|
||||||
stemp.concat(line);
|
stemp.concat(line);
|
||||||
line[len] = dummy;
|
line[len] = save_log_char;
|
||||||
|
|
||||||
Webserver->sendContent(stemp);
|
Webserver->sendContent(stemp);
|
||||||
cflg = true;
|
cflg = true;
|
||||||
}
|
}
|
||||||
|
@ -298,15 +298,15 @@ String TelegramExecuteCommand(const char *svalue) {
|
|||||||
// [14:49:36.123 MQTT: stat/wemos5/RESULT = {"POWER":"OFF"}] > [{"POWER":"OFF"}]
|
// [14:49:36.123 MQTT: stat/wemos5/RESULT = {"POWER":"OFF"}] > [{"POWER":"OFF"}]
|
||||||
char* JSON = (char*)memchr(line, '{', len);
|
char* JSON = (char*)memchr(line, '{', len);
|
||||||
if (JSON) { // Is it a JSON message (and not only [15:26:08 MQT: stat/wemos5/POWER = O])
|
if (JSON) { // Is it a JSON message (and not only [15:26:08 MQT: stat/wemos5/POWER = O])
|
||||||
size_t JSONlen = len - (JSON - line);
|
if (cflg) { response += F(","); } // Add a comma
|
||||||
if (cflg) { response += F(","); }
|
|
||||||
|
|
||||||
// response.concat(JSON +1, JSONlen -3);
|
// size_t JSONlen = len - (JSON - line);
|
||||||
len -= 2;
|
// response.concat(JSON +1, JSONlen -3); // Add terminating '\0' - Not supported on ESP32
|
||||||
char dummy = line[len];
|
len -= 2; // Skip last '}'
|
||||||
|
char save_log_char = line[len];
|
||||||
line[len] = '\0'; // Add terminating \'0'
|
line[len] = '\0'; // Add terminating \'0'
|
||||||
response.concat(JSON +1);
|
response.concat(JSON +1); // Skip first '{'
|
||||||
line[len] = dummy;
|
line[len] = save_log_char;
|
||||||
|
|
||||||
cflg = true;
|
cflg = true;
|
||||||
}
|
}
|
||||||
|
@ -675,8 +675,12 @@ void HandleBerryConsole(void)
|
|||||||
// size_t len;
|
// size_t len;
|
||||||
// WSContentFlush();
|
// WSContentFlush();
|
||||||
// while (GetLog(Settings.weblog_level, &index, &line, &len)) {
|
// while (GetLog(Settings.weblog_level, &index, &line, &len)) {
|
||||||
// String stemp = (cflg) ? "\n" : ""; // Add a newline
|
// String stemp = (cflg) ? "\n" : ""; // Add newline
|
||||||
// stemp.concat(line, len -1); // Add a terminating '\0'
|
// len--;
|
||||||
|
// char save_log_char = line[len];
|
||||||
|
// line[len] = '\0'; // Add terminating \'0'
|
||||||
|
// stemp.concat(line);
|
||||||
|
// line[len] = save_log_char;
|
||||||
// Webserver->sendContent(stemp);
|
// Webserver->sendContent(stemp);
|
||||||
// cflg = true;
|
// cflg = true;
|
||||||
// }
|
// }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user