Skip to content

Commit 3dd6aa3

Browse files
committed
Standardize log messages across platform code
1 parent da1d447 commit 3dd6aa3

File tree

8 files changed

+16
-18
lines changed

8 files changed

+16
-18
lines changed

examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ int32_t wfx_rsi_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_
388388
*****************************************************************************************/
389389
int32_t wfx_wifi_rsi_init(void)
390390
{
391-
ChipLogDetail(DeviceLayer, "wfx_wifi_rsi_init started");
391+
ChipLogDetail(DeviceLayer, "wfx_wifi_rsi_init: started");
392392
sl_status_t status;
393393
status = sl_wifi_init(&config, NULL, sl_wifi_default_event_handler);
394394
VerifyOrReturnError(status == SL_STATUS_OK, status);

examples/platform/silabs/efr32/rs911x/rsi_if.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ void wfx_rsi_task(void * arg)
813813
wfx_lwip_start();
814814
wfx_started_notify();
815815

816-
SILABS_LOG("Starting event loop");
816+
SILABS_LOG("wfx_rsi_task: starting event loop");
817817
for (;;)
818818
{
819819
osStatus_t status = osMessageQueueGet(sWifiEventQueue, &wfxEvent, NULL, osWaitForever);
@@ -823,7 +823,7 @@ void wfx_rsi_task(void * arg)
823823
}
824824
else
825825
{
826-
SILABS_LOG("Failed to get event with status: %x", status);
826+
SILABS_LOG("wfx_rsi_task: get event failed: %x", status);
827827
}
828828
}
829829
}

examples/platform/silabs/efr32/rs911x/wfx_rsi_host.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ void wfx_clear_wifi_provision(void)
165165
sl_status_t wfx_connect_to_ap(void)
166166
{
167167
VerifyOrReturnError(wfx_rsi.dev_state & WFX_RSI_ST_STA_PROVISIONED, SL_STATUS_INVALID_CONFIGURATION);
168-
// TODO: check for '\0' in SSID before printing
169-
ChipLogProgress(DeviceLayer, "Connect to access point: %s", wfx_rsi.sec.ssid);
168+
VerifyOrReturnError(strlen(wfx_rsi.sec.ssid) <= WFX_MAX_SSID_LENGTH, SL_STATUS_WOULD_OVERFLOW);
169+
ChipLogProgress(DeviceLayer, "connect to access point: %s", wfx_rsi.sec.ssid);
170170
WfxEvent_t event;
171171
event.eventType = WFX_EVT_STA_START_JOIN;
172172
WfxPostEvent(&event);

src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ void ConnectivityManagerImpl::DriveStationState()
327327
ChipLogProgress(DeviceLayer, "Attempting to connect WiFi");
328328
if ((serr = wfx_connect_to_ap()) != SL_STATUS_OK)
329329
{
330-
ChipLogError(DeviceLayer, "wfx_connect_to_ap() failed.");
330+
ChipLogError(DeviceLayer, "wfx_connect_to_ap() failed: %" PRId32, serr);
331331
}
332332
SuccessOrExit(serr);
333333

src/platform/silabs/SiWx917/wifi/wfx_notify.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,10 @@ void wfx_connected_notify(int32_t status, sl_wfx_mac_address_t * ap)
9292

9393
if (status != SUCCESS_STATUS)
9494
{
95-
ChipLogProgress(DeviceLayer, "%s: error: failed status: %ld.", __func__, status);
95+
ChipLogProgress(DeviceLayer, "wfx_connected_notify: error: failed status: %ld", status);
9696
return;
9797
}
9898

99-
ChipLogProgress(DeviceLayer, "%s: connected.", __func__);
100-
10199
memset(&evt, 0, sizeof(evt));
102100
evt.header.id = SL_WFX_CONNECT_IND_ID;
103101
evt.header.length = sizeof evt;

src/platform/silabs/efr32/wifi/ethernetif.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ static void low_level_input(struct netif * netif, uint8_t * b, uint16_t len)
148148
(memcmp(netif->hwaddr, dst_mac, netif->hwaddr_len) != 0))
149149
{
150150
#ifdef WIFI_DEBUG_ENABLED
151-
ChipLogProgress(DeviceLayer, "%s: DROP, [%02x:%02x:%02x:%02x:%02x:%02x]<-[%02x:%02x:%02x:%02x:%02x:%02x] type=%02x%02x",
152-
__func__,
151+
ChipLogProgress(DeviceLayer,
152+
"lwip_input: DROP, [%02x:%02x:%02x:%02x:%02x:%02x]<-[%02x:%02x:%02x:%02x:%02x:%02x] type=%02x%02x",
153153

154154
dst_mac[0], dst_mac[1], dst_mac[2], dst_mac[3], dst_mac[4], dst_mac[5],
155155

@@ -172,7 +172,7 @@ static void low_level_input(struct netif * netif, uint8_t * b, uint16_t len)
172172
}
173173
#ifdef WIFI_DEBUG_ENABLED
174174
ChipLogProgress(DeviceLayer,
175-
"%s: ACCEPT %ld, [%02x:%02x:%02x:%02x:%02x:%02x]<-[%02x:%02x:%02x:%02x:%02x:%02x] type=%02x%02x", __func__,
175+
"lwip_input: ACCEPT %ld, [%02x:%02x:%02x:%02x:%02x:%02x]<-[%02x:%02x:%02x:%02x:%02x:%02x] type=%02x%02x",
176176
bufferoffset,
177177

178178
dst_mac[0], dst_mac[1], dst_mac[2], dst_mac[3], dst_mac[4], dst_mac[5],

src/platform/silabs/efr32/wifi/wfx_notify.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ void wfx_connected_notify(int32_t status, sl_wfx_mac_address_t * ap)
8888

8989
if (status != SUCCESS_STATUS)
9090
{
91-
ChipLogProgress(DeviceLayer, "%s: error: failed status: %ld.", __func__, status);
91+
ChipLogProgress(DeviceLayer, "wfx_connected_notify: error: failed status: %ld", status);
9292
return;
9393
}
9494

95-
ChipLogProgress(DeviceLayer, "%s: connected.", __func__);
95+
ChipLogProgress(DeviceLayer, "wfx_connected_notify: connected");
9696

9797
memset(&evt, 0, sizeof(evt));
9898
evt.header.id = SL_WFX_CONNECT_IND_ID;
@@ -194,12 +194,12 @@ void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retry
194194
*/
195195
if (retryJoin < MAX_JOIN_RETRIES_COUNT)
196196
{
197-
ChipLogProgress(DeviceLayer, "%s: Next attempt after %d Seconds", __func__, CONVERT_MS_TO_SEC(WLAN_RETRY_TIMER_MS));
197+
ChipLogProgress(DeviceLayer, "next retry attempt after %d seconds", CONVERT_MS_TO_SEC(WLAN_RETRY_TIMER_MS));
198198
vTaskDelay(pdMS_TO_TICKS(WLAN_RETRY_TIMER_MS));
199199
}
200200
else
201201
{
202-
ChipLogProgress(DeviceLayer, "Connect failed after max %d tries", retryJoin);
202+
ChipLogProgress(DeviceLayer, "connect failed after max %d tries", retryJoin);
203203
}
204204
}
205205
else
@@ -213,7 +213,7 @@ void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retry
213213
{
214214
retryInterval = WLAN_MAX_RETRY_TIMER_MS;
215215
}
216-
ChipLogProgress(DeviceLayer, "%s: Next attempt after %ld Seconds", __func__, CONVERT_MS_TO_SEC(retryInterval));
216+
ChipLogProgress(DeviceLayer, "next retry attempt after %ld seconds", CONVERT_MS_TO_SEC(retryInterval));
217217
vTaskDelay(pdMS_TO_TICKS(retryInterval));
218218
retryInterval += retryInterval;
219219
}

src/platform/silabs/rs911x/BLEManagerImpl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ CHIP_ERROR BLEManagerImpl::_Init()
258258

259259
if (wfx_rsi.ble_task == NULL)
260260
{
261-
ChipLogError(DeviceLayer, "%s: error: failed to create ble task.", __func__);
261+
ChipLogError(DeviceLayer, "error: failed to create BLE task");
262262
}
263263

264264
// Initialize the CHIP BleLayer.

0 commit comments

Comments
 (0)