Feng 10 лет назад
Родитель
Сommit
1fab8084e1
1 измененных файлов с 0 добавлено и 49 удалено
  1. 0 49
      src/emqttd_trace.erl

+ 0 - 49
src/emqttd_trace.erl

@@ -29,11 +29,6 @@
 
 -author("Feng Lee <feng@emqtt.io>").
 
--include("emqttd_cli.hrl").
-
-%% CLI
--export([cli/1]).
-
 %% API Function Exports
 -export([start_link/0]).
 
@@ -51,48 +46,6 @@
 
 -define(TRACE_OPTIONS, [{formatter_config, [time, " [",severity,"] ", message, "\n"]}]).
 
-
-%%%=============================================================================
-%%% CLI
-%%%=============================================================================
-
-cli(["list"]) ->
-    lists:foreach(fun({{Who, Name}, LogFile}) -> 
-            ?PRINT("trace ~s ~s -> ~s~n", [Who, Name, LogFile])
-        end, all_traces());
-
-cli(["client", ClientId, "off"]) ->
-    cli(trace_off, client, ClientId);
-cli(["client", ClientId, LogFile]) ->
-    cli(trace_on, client, ClientId, LogFile);
-cli(["topic", Topic, "off"]) ->
-    cli(trace_off, topic, Topic);
-cli(["topic", Topic, LogFile]) ->
-    cli(trace_on, topic, Topic, LogFile);
-
-cli(_) ->
-    ?PRINT_CMD("trace list",                       "#query all traces"),
-    ?PRINT_CMD("trace client <ClientId> <LogFile>","#trace client with ClientId"),
-    ?PRINT_CMD("trace client <ClientId> off",      "#stop to trace client"),
-    ?PRINT_CMD("trace topic <Topic> <LogFile>",    "#trace topic with Topic"),
-    ?PRINT_CMD("trace topic <Topic> off",          "#stop to trace Topic").
-
-cli(trace_on, Who, Name, LogFile) ->
-    case start_trace({Who, list_to_binary(Name)}, LogFile) of
-        ok ->
-            ?PRINT("trace ~s ~s successfully.~n", [Who, Name]);
-        {error, Error} ->
-            ?PRINT("trace ~s ~s error: ~p~n", [Who, Name, Error])
-    end.
-
-cli(trace_off, Who, Name) ->
-    case stop_trace({Who, list_to_binary(Name)}) of
-        ok -> 
-            ?PRINT("stop to trace ~s ~s successfully.~n", [Who, Name]);
-        {error, Error} ->
-            ?PRINT("stop to trace ~s ~s error: ~p.~n", [Who, Name, Error])
-    end.
-
 %%%=============================================================================
 %%% API
 %%%=============================================================================
@@ -133,7 +86,6 @@ all_traces() ->
     gen_server:call(?MODULE, all_traces).
 
 init([]) ->
-    emqttd_ctl:register_cmd(trace, {?MODULE, cli}, []),
     {ok, #state{level = info, trace_map = #{}}}.
 
 handle_call({start_trace, Who, LogFile}, _From, State = #state{level = Level, trace_map = TraceMap}) ->
@@ -171,7 +123,6 @@ handle_info(_Info, State) ->
     {noreply, State}.
 
 terminate(_Reason, _State) ->
-    emqttd_ctl:unregister_cmd(trace),
     ok.
 
 code_change(_OldVsn, State, _Extra) ->