Fix #1465 - rename LL_* constants, introduce MG_* log macros

This commit is contained in:
Sergey Lyubka committed 2022-02-12 18:17:25 +00:00
1 parent da72dafbfb
commit 969b84043c
40 files changed
+361 -372

No files matched your search

+2 -2
View File
@@ -26,7 +26,7 @@ static void cb2(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
mg_printf(c, "GET / HTTP/1.0\r\nHost: %.*s\r\n\r\n", (int) s.len, s.ptr);
} else if (ev == MG_EV_HTTP_MSG) {
struct mg_http_message *hm = ev_data; // Print HTTP response
LOG(LL_INFO, ("Fetched:\n%.*s", (int) hm->message.len, hm->message.ptr));
MG_INFO(("Fetched:\n%.*s", (int) hm->message.len, hm->message.ptr));
c->is_closing = 1;
}
}
@@ -38,7 +38,7 @@ static void run_mongoose(void) {
mg_mgr_init(&mgr);
mg_http_listen(&mgr, SERVER_URL, cb, &mgr); // Listening server
mg_http_connect(&mgr, CLIENT_URL, cb2, &mgr); // Example client
LOG(LL_INFO, ("Starting Mongoose web server v%s", MG_VERSION));
MG_INFO(("Starting Mongoose web server v%s", MG_VERSION));
for (;;) mg_mgr_poll(&mgr, 1000);
mg_mgr_free(&mgr);
}
+6 -6
View File
@@ -33,14 +33,14 @@ static void event_handler(void *arg, esp_event_base_t event_base,
if (s_retry_num < 3) {
esp_wifi_connect();
s_retry_num++;
LOG(LL_DEBUG, ("retry to connect to the AP"));
MG_DEBUG(("retry to connect to the AP"));
} else {
xEventGroupSetBits(s_wifi_event_group, WIFI_FAIL_BIT);
}
LOG(LL_ERROR, ("connect to the AP fail"));
MG_ERROR(("connect to the AP fail"));
} else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) {
ip_event_got_ip_t *event = (ip_event_got_ip_t *) event_data;
LOG(LL_INFO, ("got ip:%s", ip4addr_ntoa(&event->ip_info.ip)));
MG_INFO(("got ip:%s", ip4addr_ntoa(&event->ip_info.ip)));
s_retry_num = 0;
xEventGroupSetBits(s_wifi_event_group, WIFI_CONNECTED_BIT);
}
@@ -71,11 +71,11 @@ void wifi_init(const char *ssid, const char *pass) {
pdFALSE, pdFALSE, portMAX_DELAY);
if (bits & WIFI_CONNECTED_BIT) {
LOG(LL_INFO, ("connected to ap SSID:%s password:%s", ssid, pass));
MG_INFO(("connected to ap SSID:%s password:%s", ssid, pass));
} else if (bits & WIFI_FAIL_BIT) {
LOG(LL_ERROR, ("Failed to connect to SSID:%s, password:%s", ssid, pass));
MG_ERROR(("Failed to connect to SSID:%s, password:%s", ssid, pass));
} else {
LOG(LL_ERROR, ("UNEXPECTED EVENT"));
MG_ERROR(("UNEXPECTED EVENT"));
}
ESP_ERROR_CHECK(esp_event_handler_unregister(IP_EVENT, IP_EVENT_STA_GOT_IP,