mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-27 12:46:34 +00:00
Add internal support for max log level
This commit is contained in:
parent
a07e17eff6
commit
77103baa0a
@ -308,7 +308,6 @@ struct TasmotaGlobal_t {
|
|||||||
bool module_changed; // Indicate module changed since last restart
|
bool module_changed; // Indicate module changed since last restart
|
||||||
bool wifi_stay_asleep; // Allow sleep only incase of ESP32 BLE
|
bool wifi_stay_asleep; // Allow sleep only incase of ESP32 BLE
|
||||||
bool no_autoexec; // Disable autoexec
|
bool no_autoexec; // Disable autoexec
|
||||||
bool enable_logging; // Enable logging
|
|
||||||
|
|
||||||
uint8_t user_globals[3]; // User set global temp/hum/press
|
uint8_t user_globals[3]; // User set global temp/hum/press
|
||||||
uint8_t init_state; // Tasmota init state
|
uint8_t init_state; // Tasmota init state
|
||||||
@ -336,6 +335,7 @@ struct TasmotaGlobal_t {
|
|||||||
uint8_t serial_in_byte; // Received byte
|
uint8_t serial_in_byte; // Received byte
|
||||||
uint8_t serial_skip; // Skip number of received messages
|
uint8_t serial_skip; // Skip number of received messages
|
||||||
uint8_t devices_present; // Max number of devices supported
|
uint8_t devices_present; // Max number of devices supported
|
||||||
|
uint8_t maxlog_level; // Max allowed log level
|
||||||
uint8_t masterlog_level; // Master log level used to override set log level
|
uint8_t masterlog_level; // Master log level used to override set log level
|
||||||
uint8_t seriallog_level; // Current copy of Settings->seriallog_level
|
uint8_t seriallog_level; // Current copy of Settings->seriallog_level
|
||||||
uint8_t syslog_level; // Current copy of Settings->syslog_level
|
uint8_t syslog_level; // Current copy of Settings->syslog_level
|
||||||
@ -432,7 +432,7 @@ void setup(void) {
|
|||||||
TasmotaGlobal.tele_period = 9999;
|
TasmotaGlobal.tele_period = 9999;
|
||||||
TasmotaGlobal.active_device = 1;
|
TasmotaGlobal.active_device = 1;
|
||||||
TasmotaGlobal.global_state.data = 0xF; // Init global state (wifi_down, mqtt_down) to solve possible network issues
|
TasmotaGlobal.global_state.data = 0xF; // Init global state (wifi_down, mqtt_down) to solve possible network issues
|
||||||
TasmotaGlobal.enable_logging = 1;
|
TasmotaGlobal.maxlog_level = LOG_LEVEL_DEBUG_MORE;
|
||||||
TasmotaGlobal.seriallog_level = LOG_LEVEL_INFO; // Allow specific serial messages until config loaded
|
TasmotaGlobal.seriallog_level = LOG_LEVEL_INFO; // Allow specific serial messages until config loaded
|
||||||
TasmotaGlobal.power_latching = 0x80000000;
|
TasmotaGlobal.power_latching = 0x80000000;
|
||||||
|
|
||||||
|
@ -699,12 +699,12 @@ void SettingsLoad(void) {
|
|||||||
#ifdef USE_UFILESYS
|
#ifdef USE_UFILESYS
|
||||||
if (1 == settings_location) {
|
if (1 == settings_location) {
|
||||||
TfsLoadFile(TASM_FILE_SETTINGS, (uint8_t*)Settings, sizeof(TSettings));
|
TfsLoadFile(TASM_FILE_SETTINGS, (uint8_t*)Settings, sizeof(TSettings));
|
||||||
AddLog(LOG_LEVEL_NONE, PSTR(D_LOG_CONFIG "Loaded from File, " D_COUNT " %lu"), Settings->save_flag);
|
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_CONFIG "Loaded from File, " D_COUNT " %lu"), Settings->save_flag);
|
||||||
} else
|
} else
|
||||||
#endif // USE_UFILESYS
|
#endif // USE_UFILESYS
|
||||||
{
|
{
|
||||||
ESP.flashRead(settings_location * SPI_FLASH_SEC_SIZE, (uint32*)Settings, sizeof(TSettings));
|
ESP.flashRead(settings_location * SPI_FLASH_SEC_SIZE, (uint32*)Settings, sizeof(TSettings));
|
||||||
AddLog(LOG_LEVEL_NONE, PSTR(D_LOG_CONFIG D_LOADED_FROM_FLASH_AT " %X, " D_COUNT " %lu"), settings_location, Settings->save_flag);
|
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_CONFIG D_LOADED_FROM_FLASH_AT " %X, " D_COUNT " %lu"), settings_location, Settings->save_flag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ESP8266
|
#endif // ESP8266
|
||||||
@ -714,7 +714,7 @@ void SettingsLoad(void) {
|
|||||||
if (source) {
|
if (source) {
|
||||||
settings_location = 1;
|
settings_location = 1;
|
||||||
if (Settings->cfg_holder == (uint16_t)CFG_HOLDER) {
|
if (Settings->cfg_holder == (uint16_t)CFG_HOLDER) {
|
||||||
AddLog(LOG_LEVEL_NONE, PSTR(D_LOG_CONFIG "Loaded from %s, " D_COUNT " %lu"), (2 == source)?"File":"NVS", Settings->save_flag);
|
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_CONFIG "Loaded from %s, " D_COUNT " %lu"), (2 == source)?"File":"NVS", Settings->save_flag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ESP32
|
#endif // ESP32
|
||||||
@ -725,7 +725,7 @@ void SettingsLoad(void) {
|
|||||||
#ifdef USE_UFILESYS
|
#ifdef USE_UFILESYS
|
||||||
if (TfsLoadFile(TASM_FILE_SETTINGS_LKG, (uint8_t*)Settings, sizeof(TSettings)) && (Settings->cfg_crc32 == GetSettingsCrc32())) {
|
if (TfsLoadFile(TASM_FILE_SETTINGS_LKG, (uint8_t*)Settings, sizeof(TSettings)) && (Settings->cfg_crc32 == GetSettingsCrc32())) {
|
||||||
settings_location = 1;
|
settings_location = 1;
|
||||||
AddLog(LOG_LEVEL_NONE, PSTR(D_LOG_CONFIG "Loaded from LKG File, " D_COUNT " %lu"), Settings->save_flag);
|
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_CONFIG "Loaded from LKG File, " D_COUNT " %lu"), Settings->save_flag);
|
||||||
} else
|
} else
|
||||||
#endif // USE_UFILESYS
|
#endif // USE_UFILESYS
|
||||||
{
|
{
|
||||||
@ -806,7 +806,7 @@ void SettingsSdkErase(void) {
|
|||||||
/********************************************************************************************/
|
/********************************************************************************************/
|
||||||
|
|
||||||
void SettingsDefault(void) {
|
void SettingsDefault(void) {
|
||||||
AddLog(LOG_LEVEL_NONE, PSTR(D_LOG_CONFIG D_USE_DEFAULTS));
|
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_CONFIG D_USE_DEFAULTS));
|
||||||
SettingsDefaultSet1();
|
SettingsDefaultSet1();
|
||||||
SettingsDefaultSet2();
|
SettingsDefaultSet2();
|
||||||
SettingsDefaultSet3();
|
SettingsDefaultSet3();
|
||||||
|
@ -2371,7 +2371,7 @@ bool GetLog(uint32_t req_loglevel, uint32_t* index_p, char** entry_pp, size_t* l
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AddLogData(uint32_t loglevel, const char* log_data, const char* log_data_payload = nullptr, const char* log_data_retained = nullptr) {
|
void AddLogData(uint32_t loglevel, const char* log_data, const char* log_data_payload = nullptr, const char* log_data_retained = nullptr) {
|
||||||
if (!TasmotaGlobal.enable_logging) { return; }
|
if (loglevel > TasmotaGlobal.maxlog_level) { return; }
|
||||||
// Store log_data in buffer
|
// Store log_data in buffer
|
||||||
// To lower heap usage log_data_payload may contain the payload data from MqttPublishPayload()
|
// To lower heap usage log_data_payload may contain the payload data from MqttPublishPayload()
|
||||||
// and log_data_retained may contain optional retained message from MqttPublishPayload()
|
// and log_data_retained may contain optional retained message from MqttPublishPayload()
|
||||||
|
@ -135,7 +135,7 @@ void Scd40Detect(void)
|
|||||||
|
|
||||||
uint16_t sn[3];
|
uint16_t sn[3];
|
||||||
error = scd40.getSerialNumber(sn);
|
error = scd40.getSerialNumber(sn);
|
||||||
AddLog(LOG_LEVEL_NONE, PSTR("SCD40 serial nr 0x%X 0x%X 0x%X") ,sn[0], sn[1], sn[2]);
|
AddLog(LOG_LEVEL_INFO, PSTR("SCD40 serial nr 0x%X 0x%X 0x%X") ,sn[0], sn[1], sn[2]);
|
||||||
|
|
||||||
// by default, start measurements, only register device if this succeeds
|
// by default, start measurements, only register device if this succeeds
|
||||||
#ifdef USE_SCD40_LOWPOWER
|
#ifdef USE_SCD40_LOWPOWER
|
||||||
|
Loading…
x
Reference in New Issue
Block a user