Browse Source

pf: eSync日志添加tag

master
SisMaker 3 years ago
parent
commit
f1b207b2e4
1 changed files with 11 additions and 10 deletions
  1. +11
    -10
      src/eSync.erl

+ 11
- 10
src/eSync.erl View File

@ -231,23 +231,23 @@ handleInfo({Port, {data, Data}}, Status, #state{srcFiles = Srcs, hrlFiles = Hrls
{BSrcs, BHrls, BConfigs, BBeams} = collSrcFiles(true),
{nextS, running, State#state{srcFiles = BSrcs, hrlFiles = BHrls, configs = BConfigs, beams = BBeams}, {isHib, true}};
_ ->
logErrors("error, eSync receive unexpect port msg ~p~n", [Data]),
logErrors("error, receive unexpect port msg ~p~n", [Data]),
kpS_S
end
end;
handleInfo({Port, closed}, running, #state{port = Port} = _State) ->
logErrors("eSync receive port closed ~n"),
logErrors("receive port closed ~n"),
{nextS, port_close, _State};
handleInfo({'EXIT', Port, Reason}, running, #state{port = Port} = _State) ->
logErrors("eSync receive port exit Reason:~p ~n", [Reason]),
logErrors("receive port exit Reason:~p ~n", [Reason]),
{nextS, {port_EXIT, Reason}, _State};
handleInfo({Port, {exit_status, Status}}, running, #state{port = Port} = _State) ->
logErrors("eSync receive port exit_status Status:~p ~p ~n", [Status, Port]),
logErrors("receive port exit_status Status:~p ~p ~n", [Status, Port]),
{nextS, {port_exit_status, Status}, _State};
handleInfo({'EXIT', _Pid, _Reason}, running, _State) ->
kpS_S;
handleInfo(_Msg, _, _State) ->
logErrors("eSync receive unexpect msg:~p ~n", [_Msg]),
logErrors("receive unexpect msg:~p ~n", [_Msg]),
kpS_S.
handleOnevent(sTimeout, waitConnOver, Status, State) ->
@ -763,18 +763,19 @@ getEnv(Var, Default) ->
setEnv(Var, Val) ->
ok = application:set_env(eSync, Var, Val).
-define(LogTag, "eSync: ").
logSuccess(Format) ->
canLog(success) andalso error_logger:info_msg(Format).
canLog(success) andalso error_logger:info_msg(?LogTag ++ Format).
logSuccess(Format, Args) ->
canLog(success) andalso error_logger:info_msg(Format, Args).
canLog(success) andalso error_logger:info_msg(?LogTag ++ Format, Args).
logErrors(Format) ->
canLog(errors) andalso error_logger:error_msg(Format).
canLog(errors) andalso error_logger:error_msg(?LogTag ++ Format).
logErrors(Format, Args) ->
canLog(errors) andalso error_logger:error_msg(Format, Args).
canLog(errors) andalso error_logger:error_msg(?LogTag ++ Format, Args).
logWarnings(Format, Args) ->
canLog(warnings) andalso error_logger:warning_msg(Format, Args).
canLog(warnings) andalso error_logger:warning_msg(?LogTag ++ Format, Args).
canLog(MsgType) ->
case eSync:getLog() of

Loading…
Cancel
Save