From 714ec1e7345386f0fe4eb3ccfa492273c6042476 Mon Sep 17 00:00:00 2001 From: anlicheng <244108715@qq.com> Date: Mon, 4 Dec 2023 13:53:06 +0800 Subject: [PATCH] add debug --- apps/iot/src/iot_host.erl | 5 ++--- apps/iot/src/iot_router.erl | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/iot/src/iot_host.erl b/apps/iot/src/iot_host.erl index 932110f..646a48d 100644 --- a/apps/iot/src/iot_host.erl +++ b/apps/iot/src/iot_host.erl @@ -501,10 +501,9 @@ code_change(_OldVsn, StateName, State = #state{}, _Extra) -> handle_data(#{<<"device_uuid">> := DeviceUUID, <<"service_name">> := ServiceName, <<"at">> := Timestamp, <<"fields">> := FieldsList, <<"tags">> := Tags}, #state{uuid = UUID}) when is_binary(DeviceUUID), DeviceUUID /= <<>> -> - lager:debug("[iot_host] host: ~p, handle device data: ~p, fields: ~p, tags: ~p", [UUID, DeviceUUID, FieldsList, Tags]), - case iot_device:get_pid(DeviceUUID) of undefined -> + lager:warning("[iot_host] host uuid: ~p, device uuid: ~p not found, fields: ~p, tags: ~p", [UUID, DeviceUUID, FieldsList, Tags]), ok; DevicePid when is_pid(DevicePid) -> case iot_device:is_activated(DevicePid) of @@ -518,7 +517,7 @@ handle_data(#{<<"device_uuid">> := DeviceUUID, <<"service_name">> := ServiceName iot_device:change_status(DevicePid, ?DEVICE_ONLINE); false -> - lager:notice("[iot_host] uuid: ~p, device_uuid: ~p, device is not activated", [UUID, DeviceUUID]) + lager:warning("[iot_host] host uuid: ~p, device_uuid: ~p not activated, fields: ~p, tags: ~p", [UUID, DeviceUUID, FieldsList, Tags]) end end; diff --git a/apps/iot/src/iot_router.erl b/apps/iot/src/iot_router.erl index 46a60c1..5d46a78 100644 --- a/apps/iot/src/iot_router.erl +++ b/apps/iot/src/iot_router.erl @@ -18,9 +18,9 @@ route_uuid(RouterUUID, Fields, Timestamp) when is_binary(RouterUUID), is_list(Fi %% 查找终端设备对应的点位信息 case redis_client:hget(RouterUUID, <<"location_code">>) of {ok, undefined} -> - lager:debug("[iot_host] the north_data hget location_code, uuid: ~p, not found", [RouterUUID]); + lager:warning("[iot_host] the north_data hget location_code, uuid: ~p, not found", [RouterUUID]); {ok, LocationCode} when is_binary(LocationCode) -> iot_zd_endpoint:forward(LocationCode, Fields, Timestamp); {error, Reason} -> - lager:debug("[iot_host] the north_data hget location_code uuid: ~p, get error: ~p", [RouterUUID, Reason]) + lager:warning("[iot_host] the north_data hget location_code uuid: ~p, get error: ~p", [RouterUUID, Reason]) end. \ No newline at end of file