fix zd_consumer
This commit is contained in:
parent
b0e7b6599e
commit
bce32598d3
@ -158,8 +158,21 @@ handle_info({directive_reply, Reply}, State = #state{logger_pid = LoggerPid, fli
|
|||||||
FlightInfo = <<"flight_num: ", (integer_to_binary(FlightNum - 1))/binary>>,
|
FlightInfo = <<"flight_num: ", (integer_to_binary(FlightNum - 1))/binary>>,
|
||||||
case Reply of
|
case Reply of
|
||||||
{ok, RawReq, DirectiveResult} ->
|
{ok, RawReq, DirectiveResult} ->
|
||||||
|
case DirectiveResult of
|
||||||
|
ok ->
|
||||||
|
iot_logger:write(LoggerPid, [<<"[success]">>, RawReq, <<"OK">>, FlightInfo]);
|
||||||
|
{ok, Response} when is_binary(Response) ->
|
||||||
|
iot_logger:write(LoggerPid, [<<"[success]">>, RawReq, Response, FlightInfo]);
|
||||||
|
{error, Reason0} ->
|
||||||
|
Reason = if
|
||||||
|
is_atom(Reason0) -> atom_to_binary(Reason0);
|
||||||
|
is_binary(Reason0) -> Reason0;
|
||||||
|
true -> <<"Unknow error">>
|
||||||
|
end,
|
||||||
|
iot_logger:write(LoggerPid, [<<"[error]">>, RawReq, Reason, FlightInfo])
|
||||||
|
end,
|
||||||
iot_logger:write(LoggerPid, [<<"[success]">>, RawReq, DirectiveResult, FlightInfo]);
|
iot_logger:write(LoggerPid, [<<"[success]">>, RawReq, DirectiveResult, FlightInfo]);
|
||||||
{error, RawReq, Error} ->
|
{error, RawReq, Error} when is_binary(Error) ->
|
||||||
iot_logger:write(LoggerPid, [<<"[error]">>, RawReq, Error, FlightInfo])
|
iot_logger:write(LoggerPid, [<<"[error]">>, RawReq, Error, FlightInfo])
|
||||||
end,
|
end,
|
||||||
{noreply, State#state{flight_num = FlightNum - 1}};
|
{noreply, State#state{flight_num = FlightNum - 1}};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user