Просмотр исходного кода

Disable heap logs by default (#1464)

* disabale heap logs by default

* Cleanup log (INFO->DEBUG)
Slider0007 3 лет назад
Родитель
Сommit
a8b9acf170

+ 1 - 1
code/components/jomjol_controlGPIO/server_GPIO.cpp

@@ -30,7 +30,7 @@
 static const char *TAG = "GPIO";
 QueueHandle_t gpio_queue_handle = NULL;
 
-#define DEBUG_DETAIL_ON 
+//#define DEBUG_DETAIL_ON 
 
 GpioPin::GpioPin(gpio_num_t gpio, const char* name, gpio_pin_mode_t mode, gpio_int_type_t interruptType, uint8_t dutyResolution, std::string mqttTopic, bool httpEnable) 
 {

+ 3 - 3
code/components/jomjol_fileserver_ota/server_file.cpp

@@ -506,7 +506,7 @@ static esp_err_t send_logfile(httpd_req_t *req, bool send_full_file)
 
     /* Close file after sending complete */
     fclose(fd);
-    ESP_LOGI(TAG, "File sending complete");
+    ESP_LOGD(TAG, "File sending complete");
 
     /* Respond with an empty chunk to signal HTTP response completion */
     httpd_resp_send_chunk(req, NULL, 0);
@@ -582,7 +582,7 @@ static esp_err_t download_get_handler(httpd_req_t *req)
 
     httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
 
-    ESP_LOGI(TAG, "Sending file : %s (%ld bytes)...", filename, file_stat.st_size);
+    ESP_LOGD(TAG, "Sending file : %s (%ld bytes)...", filename, file_stat.st_size);
     set_content_type_from_file(req, filename);
 
     /* Retrieve the pointer to scratch buffer for temporary storage */
@@ -608,7 +608,7 @@ static esp_err_t download_get_handler(httpd_req_t *req)
 
     /* Close file after sending complete */
     fclose(fd);
-    ESP_LOGI(TAG, "File successfully sent");
+    ESP_LOGD(TAG, "File successfully sent");
 
     /* Respond with an empty chunk to signal HTTP response completion */
     httpd_resp_send_chunk(req, NULL, 0);

+ 2 - 2
code/components/jomjol_fileserver_ota/server_help.cpp

@@ -42,7 +42,7 @@ esp_err_t send_file(httpd_req_t *req, std::string filename)
         return ESP_FAIL;
     }
 
-    ESP_LOGI(TAG, "Sending file : %s ...", filename.c_str());
+    ESP_LOGD(TAG, "Sending file : %s ...", filename.c_str());
 //    httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
     set_content_type_from_file(req, filename.c_str());
 
@@ -69,7 +69,7 @@ esp_err_t send_file(httpd_req_t *req, std::string filename)
 
     /* Close file after sending complete */
     fclose(fd);
-    ESP_LOGI(TAG, "File sending complete");    
+    ESP_LOGD(TAG, "File sending complete");    
     return ESP_OK;    
 }
 

+ 4 - 4
code/components/jomjol_flowcontroll/ClassFlowControll.cpp

@@ -564,7 +564,7 @@ bool ClassFlowControll::ReadParameter(FILE* pfile, string& aktparamgraph)
 int ClassFlowControll::CleanTempFolder() {
     const char* folderPath = "/sdcard/img_tmp";
     
-    ESP_LOGI(TAG, "Clean up temporary folder to avoid damage of sdcard sectors : %s", folderPath);
+    ESP_LOGD(TAG, "Clean up temporary folder to avoid damage of sdcard sectors : %s", folderPath);
     DIR *dir = opendir(folderPath);
     if (!dir) {
         ESP_LOGE(TAG, "Failed to stat dir : %s", folderPath);
@@ -586,7 +586,7 @@ int ClassFlowControll::CleanTempFolder() {
 		}
     }
     closedir(dir);
-    ESP_LOGI(TAG, "%d files deleted", deleted);
+    ESP_LOGD(TAG, "%d files deleted", deleted);
     
     return 0;
 }
@@ -674,10 +674,10 @@ esp_err_t ClassFlowControll::GetJPGStream(std::string _fn, httpd_req_t *req)
 
     if (_send)
     {
-        ESP_LOGI(TAG, "Sending file : %s ...", _fn.c_str());
+        ESP_LOGD(TAG, "Sending file : %s ...", _fn.c_str());
         set_content_type_from_file(req, _fn.c_str());
         result = _send->SendJPGtoHTTP(req);
-        ESP_LOGI(TAG, "File sending complete");    
+        ESP_LOGD(TAG, "File sending complete");    
         /* Respond with an empty chunk to signal HTTP response completion */
         httpd_resp_send_chunk(req, NULL, 0);
     }

+ 1 - 1
code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp

@@ -858,7 +858,7 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
 
         string _zw = "PostProcessing - Raw: " + NUMBERS[j]->ReturnRawValue + " Value: " + NUMBERS[j]->ReturnValue + " Error: " + NUMBERS[j]->ErrorMessageText;
         ESP_LOGD(TAG, "%s", zw.c_str());
-        LogFile.WriteToFile(ESP_LOG_INFO, TAG, _zw);
+        LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, _zw);
         WriteDataLog(j);
     }
 

+ 1 - 0
code/components/jomjol_image_proc/CAlignAndCutImage.cpp

@@ -12,6 +12,7 @@ static const char* TAG = "c_align_and_cut_image";
 //#define GET_MEMORY malloc
 #define GET_MEMORY(X) heap_caps_malloc(X, MALLOC_CAP_SPIRAM)
 
+// #define DEBUG_DETAIL_ON 
 
 
 CAlignAndCutImage::CAlignAndCutImage(CImageBasis *_org, CImageBasis *_temp)

+ 5 - 5
code/components/jomjol_logfile/ClassLogFile.cpp

@@ -23,10 +23,10 @@ ClassLogFile LogFile("/sdcard/log/message", "log_%Y-%m-%d.txt", "/sdcard/log/dat
 void ClassLogFile::WriteHeapInfo(std::string _id)
 {
     std::string _zw = _id;
-    if (loglevel > ESP_LOG_WARN) 
+    if (loglevel >= ESP_LOG_DEBUG) {
         _zw =  _zw + "\t" + getESPHeapInfo();
-
-    WriteToFile(ESP_LOG_DEBUG, "HEAP", _zw);
+        WriteToFile(ESP_LOG_DEBUG, "HEAP", _zw);
+    }
 }
 
 
@@ -339,7 +339,7 @@ void ClassLogFile::RemoveOldLogFile()
             }
         }
     }
-    ESP_LOGI(TAG, "log files deleted: %d | files not deleted (incl. leer.txt): %d", deleted, notDeleted);	
+    ESP_LOGD(TAG, "log files deleted: %d | files not deleted (incl. leer.txt): %d", deleted, notDeleted);	
     closedir(dir);
 }
 
@@ -390,7 +390,7 @@ void ClassLogFile::RemoveOldDataLog()
             }
         }
     }
-    ESP_LOGI(TAG, "data files deleted: %d | files not deleted (incl. leer.txt): %d", deleted, notDeleted);	
+    ESP_LOGD(TAG, "data files deleted: %d | files not deleted (incl. leer.txt): %d", deleted, notDeleted);	
     closedir(dir);
 }
 

+ 11 - 3
code/components/jomjol_mqtt/interface_mqtt.cpp

@@ -8,6 +8,8 @@
 
 #define __HIDE_PASSWORD
 
+//#define DEBUG_DETAIL_ON 
+
 static const char *TAG = "MQTT INTERFACE";
 
 std::map<std::string, std::function<void()>>* connectFunktionMap = NULL;  
@@ -34,7 +36,9 @@ bool MQTTPublish(std::string _key, std::string _content, int retained_flag) {
         return true; // Fail quietly
     }
 
-    LogFile.WriteHeapInfo("MQTT Publish");
+    #ifdef DEBUG_DETAIL_ON  
+        LogFile.WriteHeapInfo("MQTT Publish");
+    #endif
 
     if (!mqtt_connected) {
         LogFile.WriteToFile(ESP_LOG_WARN, TAG, "Not connected, trying to re-connect...");
@@ -183,7 +187,9 @@ bool MQTT_Init() {
         mqtt_cfg.password = password.c_str();
     };
 
-    LogFile.WriteHeapInfo("MQTT Client Init");
+    #ifdef DEBUG_DETAIL_ON  
+        LogFile.WriteHeapInfo("MQTT Client Init");
+    #endif
     client = esp_mqtt_client_init(&mqtt_cfg);
     if (client)
     {
@@ -194,7 +200,9 @@ bool MQTT_Init() {
             return false;
         }
 
-        LogFile.WriteHeapInfo("MQTT Client Start");
+        #ifdef DEBUG_DETAIL_ON  
+            LogFile.WriteHeapInfo("MQTT Client Start");
+        #endif
         ret = esp_mqtt_client_start(client);
         if (ret != ESP_OK)
         {

+ 1 - 1
code/components/jomjol_tfliteclass/server_tflite.cpp

@@ -23,7 +23,7 @@
 #include "server_file.h"
 #include "connect_wlan.h"
 
-#define DEBUG_DETAIL_ON       
+//#define DEBUG_DETAIL_ON       
 
 
 ClassFlowControll tfliteflow;