|
10 | 10 | #ifdef CONFIG_ESP_INSIGHTS_ENABLED
|
11 | 11 | #include <esp_rmaker_mqtt.h>
|
12 | 12 | #include <esp_insights.h>
|
13 |
| -#include <esp_diagnostics_system_metrics.h> |
| 13 | +#include <string.h> |
| 14 | +#include <esp_rmaker_core.h> |
| 15 | +#include <esp_rmaker_factory.h> |
14 | 16 |
|
15 | 17 | #if CONFIG_APP_INSIGHTS_ENABLE_LOG_TYPE_ALL
|
16 | 18 | #define APP_INSIGHTS_LOG_TYPE ESP_DIAG_LOG_TYPE_ERROR \
|
| 19 | + | ESP_DIAG_LOG_TYPE_WARNING \ |
17 | 20 | | ESP_DIAG_LOG_TYPE_EVENT
|
18 | 21 | #else
|
19 |
| -#define APP_INSIGHTS_LOG_TYPE 0 |
| 22 | +#define APP_INSIGHTS_LOG_TYPE ESP_DIAG_LOG_TYPE_ERROR |
20 | 23 | #endif /* CONFIG_APP_INSIGHTS_ENABLE_LOG_TYPE_ALL */
|
21 | 24 |
|
| 25 | +esp_err_t esp_insights_enable(esp_insights_config_t *config); |
| 26 | + |
22 | 27 | #endif /* CONFIG_ESP_INSIGHTS_ENABLED */
|
23 | 28 |
|
24 |
| -static const char *TAG = "app_insights"; |
| 29 | +#define TAG "app_insights" |
25 | 30 |
|
26 | 31 | esp_err_t app_insights_enable(void)
|
27 | 32 | {
|
@@ -49,12 +54,7 @@ esp_err_t app_insights_enable(void)
|
49 | 54 | esp_insights_config_t config = {
|
50 | 55 | .log_type = APP_INSIGHTS_LOG_TYPE,
|
51 | 56 | };
|
52 |
| - esp_insights_rmaker_enable(&config); |
53 |
| - ESP_LOGI(TAG, "App Insights Enabled."); |
54 |
| -#ifdef CONFIG_DIAG_ENABLE_HEAP_METRICS |
55 |
| - /* Dump heap metrics */ |
56 |
| - esp_diag_heap_metrics_dump(); |
57 |
| -#endif /* CONFIG_DIAG_ENABLE_HEAP_METRICS */ |
| 57 | + esp_insights_enable(&config); |
58 | 58 | #else
|
59 | 59 | ESP_LOGI(TAG, "Enable CONFIG_ESP_INSIGHTS_ENABLED to get Insights.");
|
60 | 60 | #endif /* ! CONFIG_ESP_INSIGHTS_ENABLED */
|
|
0 commit comments