mirror of https://github.com/arendst/Tasmota.git
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);
|
||||
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();
|
||||
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--;
|
||||
char dummy = line[len];
|
||||
char save_log_char = line[len];
|
||||
line[len] = '\0'; // Add terminating \'0'
|
||||
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
|
||||
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"}]
|
||||
char* JSON = (char*)memchr(line, '{', len);
|
||||
if (JSON) { // Is it a JSON message (and not only [15:26:08 MQT: stat/wemos5/POWER = O])
|
||||
String stemp = (cflg) ? "," : ""; // Add a comma
|
||||
size_t JSONlen = len - (JSON - line);
|
||||
String stemp = (cflg) ? "," : ""; // Add comma
|
||||
|
||||
// stemp.concat(JSON +1, JSONlen -3); // Add a terminating '\0'
|
||||
len -= 2;
|
||||
char dummy = line[len];
|
||||
line[len] = '\0'; // Add terminating \'0'
|
||||
stemp.concat(JSON +1);
|
||||
line[len] = dummy;
|
||||
// size_t JSONlen = len - (JSON - line);
|
||||
// stemp.concat(JSON +1, JSONlen -3); // Add terminating '\0' - Not supported on ESP32
|
||||
len -= 2; // Skip last '}'
|
||||
char save_log_char = line[len];
|
||||
line[len] = '\0'; // Add terminating \'0'
|
||||
stemp.concat(JSON +1); // Skip first '{'
|
||||
line[len] = save_log_char;
|
||||
|
||||
Webserver->sendContent(stemp);
|
||||
cflg = true;
|
||||
|
@ -2937,13 +2937,15 @@ void HandleConsoleRefresh(void)
|
|||
size_t len;
|
||||
WSContentFlush();
|
||||
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--;
|
||||
// stemp.concat(line, len); // Add a terminating '\0'
|
||||
char dummy = line[len];
|
||||
char save_log_char = line[len];
|
||||
line[len] = '\0'; // Add terminating \'0'
|
||||
stemp.concat(line);
|
||||
line[len] = dummy;
|
||||
line[len] = save_log_char;
|
||||
|
||||
Webserver->sendContent(stemp);
|
||||
cflg = true;
|
||||
}
|
||||
|
|
|
@ -298,15 +298,15 @@ String TelegramExecuteCommand(const char *svalue) {
|
|||
// [14:49:36.123 MQTT: stat/wemos5/RESULT = {"POWER":"OFF"}] > [{"POWER":"OFF"}]
|
||||
char* JSON = (char*)memchr(line, '{', len);
|
||||
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(","); }
|
||||
if (cflg) { response += F(","); } // Add a comma
|
||||
|
||||
// response.concat(JSON +1, JSONlen -3);
|
||||
len -= 2;
|
||||
char dummy = line[len];
|
||||
// size_t JSONlen = len - (JSON - line);
|
||||
// response.concat(JSON +1, JSONlen -3); // Add terminating '\0' - Not supported on ESP32
|
||||
len -= 2; // Skip last '}'
|
||||
char save_log_char = line[len];
|
||||
line[len] = '\0'; // Add terminating \'0'
|
||||
response.concat(JSON +1);
|
||||
line[len] = dummy;
|
||||
response.concat(JSON +1); // Skip first '{'
|
||||
line[len] = save_log_char;
|
||||
|
||||
cflg = true;
|
||||
}
|
||||
|
|
|
@ -296,7 +296,7 @@ void BerryInit(void) {
|
|||
|
||||
/*********************************************************************************************\
|
||||
* Execute a script in Flash file-system
|
||||
*
|
||||
*
|
||||
* Two options supported:
|
||||
* berry_preinit: load "preinit.be" to configure the device before driver pre-init and init
|
||||
* (typically I2C drivers, and AXP192/AXP202 configuration)
|
||||
|
@ -675,8 +675,12 @@ void HandleBerryConsole(void)
|
|||
// size_t len;
|
||||
// WSContentFlush();
|
||||
// while (GetLog(Settings.weblog_level, &index, &line, &len)) {
|
||||
// String stemp = (cflg) ? "\n" : ""; // Add a newline
|
||||
// stemp.concat(line, len -1); // Add a terminating '\0'
|
||||
// String stemp = (cflg) ? "\n" : ""; // Add newline
|
||||
// len--;
|
||||
// char save_log_char = line[len];
|
||||
// line[len] = '\0'; // Add terminating \'0'
|
||||
// stemp.concat(line);
|
||||
// line[len] = save_log_char;
|
||||
// Webserver->sendContent(stemp);
|
||||
// cflg = true;
|
||||
// }
|
||||
|
|
Loading…
Reference in New Issue