fix logger
This commit is contained in:
parent
5cc10ee019
commit
4306b94bf0
@ -154,6 +154,12 @@ handle_info({'EXIT', ConnPid, Reason}, State = #state{conn_pid = ConnPid}) ->
|
||||
|
||||
{noreply, State#state{conn_pid = undefined}};
|
||||
|
||||
handle_info({'EXIT', LoggerPid, Reason}, State = #state{logger_pid = LoggerPid}) ->
|
||||
lager:warning("[iot_zd_consumer] logger exited with reason: ~p", [Reason]),
|
||||
{ok, LoggerPid} = iot_logger:start_link("zd_directive_data"),
|
||||
|
||||
{noreply, State#state{logger_pid = LoggerPid}};
|
||||
|
||||
handle_info({directive_reply, Reply}, State = #state{logger_pid = LoggerPid, flight_num = FlightNum}) ->
|
||||
FlightInfo = <<"flight_num: ", (integer_to_binary(FlightNum - 1))/binary>>,
|
||||
case Reply of
|
||||
@ -170,8 +176,7 @@ handle_info({directive_reply, Reply}, State = #state{logger_pid = LoggerPid, fli
|
||||
true -> <<"Unknow error">>
|
||||
end,
|
||||
iot_logger:write(LoggerPid, [<<"[error]">>, RawReq, Reason, FlightInfo])
|
||||
end,
|
||||
iot_logger:write(LoggerPid, [<<"[success]">>, RawReq, DirectiveResult, FlightInfo]);
|
||||
end;
|
||||
{error, RawReq, Error} when is_binary(Error) ->
|
||||
iot_logger:write(LoggerPid, [<<"[error]">>, RawReq, Error, FlightInfo])
|
||||
end,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user