Tune the log level
This commit is contained in:
parent
50c312e736
commit
cc6696f8cb
|
@ -70,7 +70,7 @@ handle_request(Method, Path, Req) ->
|
|||
|
||||
http_publish(Req) ->
|
||||
Params = [{iolist_to_binary(Key), Val} || {Key, Val} <- mochiweb_request:parse_post(Req)],
|
||||
lager:info("HTTP Publish: ~p", [Params]),
|
||||
lager:debug("HTTP Publish: ~p", [Params]),
|
||||
Topics = topics(Params),
|
||||
ClientId = get_value(<<"client">>, Params, http),
|
||||
Qos = int(get_value(<<"qos">>, Params, "0")),
|
||||
|
|
|
@ -156,8 +156,8 @@ load_app(App) ->
|
|||
start_app(App, SuccFun) ->
|
||||
case application:ensure_all_started(App) of
|
||||
{ok, Started} ->
|
||||
lager:info("started Apps: ~p", [Started]),
|
||||
lager:info("load plugin ~p successfully", [App]),
|
||||
lager:info("Started Apps: ~p", [Started]),
|
||||
lager:info("Load plugin ~p successfully", [App]),
|
||||
SuccFun(App),
|
||||
{ok, Started};
|
||||
{error, {ErrApp, Reason}} ->
|
||||
|
@ -196,11 +196,11 @@ unload_plugin(App, Persistent) ->
|
|||
stop_app(App) ->
|
||||
case application:stop(App) of
|
||||
ok ->
|
||||
lager:info("stop plugin ~p successfully~n", [App]), ok;
|
||||
lager:info("Stop plugin ~p successfully~n", [App]), ok;
|
||||
{error, {not_started, App}} ->
|
||||
lager:error("plugin ~p is not started~n", [App]), ok;
|
||||
lager:error("Plugin ~p is not started~n", [App]), ok;
|
||||
{error, Reason} ->
|
||||
lager:error("stop plugin ~p error: ~p", [App]), {error, Reason}
|
||||
lager:error("Stop plugin ~p error: ~p", [App]), {error, Reason}
|
||||
end.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
|
|
|
@ -344,10 +344,10 @@ send(Packet = ?PACKET(Type),
|
|||
{ok, State#proto_state{stats_data = Stats1}}.
|
||||
|
||||
trace(recv, Packet, ProtoState) ->
|
||||
?LOG(info, "RECV ~s", [emqttd_packet:format(Packet)], ProtoState);
|
||||
?LOG(debug, "RECV ~s", [emqttd_packet:format(Packet)], ProtoState);
|
||||
|
||||
trace(send, Packet, ProtoState) ->
|
||||
?LOG(info, "SEND ~s", [emqttd_packet:format(Packet)], ProtoState).
|
||||
?LOG(debug, "SEND ~s", [emqttd_packet:format(Packet)], ProtoState).
|
||||
|
||||
inc_stats(_Direct, _Type, Stats = #proto_stats{enable_stats = false}) ->
|
||||
Stats;
|
||||
|
@ -382,7 +382,7 @@ shutdown(conflict, #proto_state{client_id = _ClientId}) ->
|
|||
ignore;
|
||||
|
||||
shutdown(Error, State = #proto_state{will_msg = WillMsg}) ->
|
||||
?LOG(info, "Shutdown for ~p", [Error], State),
|
||||
?LOG(debug, "Shutdown for ~p", [Error], State),
|
||||
Client = client(State),
|
||||
send_willmsg(Client, WillMsg),
|
||||
emqttd_hooks:run('client.disconnected', [Error], Client),
|
||||
|
|
|
@ -102,11 +102,11 @@ trace(publish, From, _Msg) when is_atom(From) ->
|
|||
%% Dont' trace '$SYS' publish
|
||||
ignore;
|
||||
trace(publish, {ClientId, Username}, #mqtt_message{topic = Topic, payload = Payload}) ->
|
||||
lager:info([{client, ClientId}, {topic, Topic}],
|
||||
"~s/~s PUBLISH to ~s: ~p", [ClientId, Username, Topic, Payload]);
|
||||
trace(publish, From, #mqtt_message{topic = Topic, payload = Payload}) when is_binary(From); is_list(From) ->
|
||||
lager:info([{client, From}, {topic, Topic}],
|
||||
"~s PUBLISH to ~s: ~p", [From, Topic, Payload]).
|
||||
lager:debug([{client, ClientId}, {topic, Topic}],
|
||||
"~s/~s PUBLISH to ~s: ~p", [ClientId, Username, Topic, Payload]);
|
||||
trace(publish, From, #mqtt_message{topic = Topic, payload = Payload}) ->
|
||||
lager:debug([{client, From}, {topic, Topic}],
|
||||
"~s PUBLISH to ~s: ~p", [From, Topic, Payload]).
|
||||
|
||||
%% @doc Unsubscribe
|
||||
-spec(unsubscribe(binary()) -> ok | emqttd:pubsub_error()).
|
||||
|
|
|
@ -379,7 +379,7 @@ handle_cast({subscribe, _From, TopicTable, AckFun},
|
|||
State = #state{client_id = ClientId,
|
||||
username = Username,
|
||||
subscriptions = Subscriptions}) ->
|
||||
?LOG(info, "Subscribe ~p", [TopicTable], State),
|
||||
?LOG(debug, "Subscribe ~p", [TopicTable], State),
|
||||
{GrantedQos, Subscriptions1} =
|
||||
lists:foldl(fun({Topic, Opts}, {QosAcc, SubMap}) ->
|
||||
NewQos = proplists:get_value(qos, Opts),
|
||||
|
@ -407,7 +407,7 @@ handle_cast({unsubscribe, _From, TopicTable},
|
|||
State = #state{client_id = ClientId,
|
||||
username = Username,
|
||||
subscriptions = Subscriptions}) ->
|
||||
?LOG(info, "Unsubscribe ~p", [TopicTable], State),
|
||||
?LOG(debug, "Unsubscribe ~p", [TopicTable], State),
|
||||
Subscriptions1 =
|
||||
lists:foldl(fun({Topic, Opts}, SubMap) ->
|
||||
case maps:find(Topic, SubMap) of
|
||||
|
@ -482,7 +482,7 @@ handle_cast({resume, ClientId, ClientPid},
|
|||
await_rel_timer = AwaitTimer,
|
||||
expiry_timer = ExpireTimer}) ->
|
||||
|
||||
?LOG(info, "Resumed by ~p", [ClientPid], State),
|
||||
?LOG(debug, "Resumed by ~p", [ClientPid], State),
|
||||
|
||||
%% Cancel Timers
|
||||
lists:foreach(fun emqttd_misc:cancel_timer/1,
|
||||
|
@ -552,7 +552,7 @@ handle_info({timeout, _Timer, check_awaiting_rel}, State) ->
|
|||
hibernate(expire_awaiting_rel(emit_stats(State#state{await_rel_timer = undefined})));
|
||||
|
||||
handle_info({timeout, _Timer, expired}, State) ->
|
||||
?LOG(info, "Expired, shutdown now.", [], State),
|
||||
?LOG(debug, "Expired, shutdown now.", [], State),
|
||||
shutdown(expired, State);
|
||||
|
||||
handle_info({'EXIT', ClientPid, _Reason},
|
||||
|
@ -563,7 +563,7 @@ handle_info({'EXIT', ClientPid, Reason},
|
|||
State = #state{clean_sess = false,
|
||||
client_pid = ClientPid,
|
||||
expiry_interval = Interval}) ->
|
||||
?LOG(info, "Client ~p EXIT for ~p", [ClientPid, Reason], State),
|
||||
?LOG(debug, "Client ~p EXIT for ~p", [ClientPid, Reason], State),
|
||||
ExpireTimer = start_timer(Interval, expired),
|
||||
State1 = State#state{client_pid = undefined, expiry_timer = ExpireTimer},
|
||||
hibernate(emit_stats(State1));
|
||||
|
|
|
@ -39,7 +39,7 @@ handle_request(Req) ->
|
|||
%% MQTT Over WebSocket
|
||||
%%--------------------------------------------------------------------
|
||||
handle_request('GET', "/mqtt", Req) ->
|
||||
lager:info("WebSocket Connection from: ~s", [Req:get(peer)]),
|
||||
lager:debug("WebSocket Connection from: ~s", [Req:get(peer)]),
|
||||
Upgrade = Req:get_header_value("Upgrade"),
|
||||
Proto = check_protocol_header(Req),
|
||||
case {is_websocket(Upgrade), Proto} of
|
||||
|
|
Loading…
Reference in New Issue