Fix copyright and unify log method

This commit is contained in:
Gilbert Wong 2019-02-27 10:46:30 +08:00
parent 9dbc34c376
commit 911a813891
17 changed files with 30 additions and 30 deletions

View File

@ -1,4 +1,4 @@
%% Copyright (c) 2019 EMQ Technologies Co., Ltd. All Rights Reserved.
%% Copyright (c) 2013-2019 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.

View File

@ -39,3 +39,5 @@
begin
(logger:log(Level,#{},#{report_cb => fun(_) -> {(Format), (Args)} end}))
end).
-define(LOG(Level, Format), ?LOG(Level, Format, [])).

View File

@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 2017-2013-2019. All Rights Reserved.
%% Copyright Ericsson AB 2013-2019. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.

View File

@ -1,4 +1,4 @@
%% Copyright (c) 2019 EMQ Technologies Co., Ltd. All Rights Reserved.
%% Copyright (c) 2013-2019 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@ -54,8 +54,8 @@ start(Module, Config) ->
{ok, Ref, Conn};
{error, Reason} ->
Config1 = obfuscate(Config),
?ERROR("Failed to connect with module=~p\n"
"config=~p\nreason:~p", [Module, Config1, Reason]),
?LOG(error, "Failed to connect with module=~p\n"
"config=~p\nreason:~p", [Module, Config1, Reason]),
error
end.

View File

@ -1,4 +1,4 @@
%% Copyright (c) 2013-2013-2019 EMQ Technologies Co., Ltd. All Rights Reserved.
%% Copyright (c) 2013-2019 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@ -28,4 +28,3 @@ multicall(Nodes, Mod, Fun, Args) ->
cast(Node, Mod, Fun, Args) ->
?RPC:cast(Node, Mod, Fun, Args).

View File

@ -31,7 +31,7 @@
-type(pubsub() :: publish | subscribe).
-type(topic() :: binary()).
-type(subid() :: binary() | atom()).
-type(subopts() :: #{qos := eqmx_mqtt_types:qos(),
-type(subopts() :: #{qos := emqx_mqtt_types:qos(),
share => binary(),
atom() => term()
}).
@ -59,4 +59,3 @@
-type(alarm() :: #alarm{}).
-type(plugin() :: #plugin{}).
-type(command() :: #command{}).

View File

@ -279,7 +279,7 @@ standing_by(state_timeout, do_connect, State) ->
standing_by({call, From}, _Call, _State) ->
{keep_state_and_data, [{reply, From, {error,standing_by}}]};
standing_by(info, Info, State) ->
?INFO("Portal ~p discarded info event at state standing_by:\n~p", [name(), Info]),
?LOG(info, "Portal ~p discarded info event at state standing_by:\n~p", [name(), Info]),
{keep_state_and_data, State};
standing_by(Type, Content, State) ->
common(standing_by, Type, Content, State).
@ -298,7 +298,7 @@ connecting(enter, _, #{reconnect_delay_ms := Timeout,
ok = subscribe_local_topics(Forwards),
case ConnectFun(Subs) of
{ok, ConnRef, Conn} ->
?INFO("Portal ~p connected", [name()]),
?LOG(info, "Portal ~p connected", [name()]),
Action = {state_timeout, 0, connected},
{keep_state, State#{conn_ref => ConnRef, connection => Conn}, Action};
error ->
@ -348,7 +348,7 @@ connected(info, {disconnected, ConnRef, Reason},
#{conn_ref := ConnRefCurrent, connection := Conn} = State) ->
case ConnRefCurrent =:= ConnRef of
true ->
?INFO("Portal ~p diconnected~nreason=~p", [name(), Conn, Reason]),
?LOG(info, "Portal ~p diconnected~nreason=~p", [name(), Conn, Reason]),
{next_state, connecting,
State#{conn_ref := undefined, connection := undefined}};
false ->
@ -360,7 +360,7 @@ connected(info, {batch_ack, Ref}, State) ->
keep_state_and_data;
bad_order ->
%% try re-connect then re-send
?ERROR("Bad order ack received by portal ~p", [name()]),
?LOG(error, "Bad order ack received by portal ~p", [name()]),
{next_state, connecting, disconnect(State)};
{ok, NewState} ->
{keep_state, NewState, ?maybe_send}
@ -391,7 +391,7 @@ common(_StateName, info, {dispatch, _, Msg},
NewQ = replayq:append(Q, collect([Msg])),
{keep_state, State#{replayq => NewQ}, ?maybe_send};
common(StateName, Type, Content, State) ->
?INFO("Portal ~p discarded ~p type event at state ~p:\n~p",
?LOG(info, "Portal ~p discarded ~p type event at state ~p:\n~p",
[name(), Type, StateName, Content]),
{keep_state, State}.
@ -462,7 +462,7 @@ retry_inflight(#{inflight := Inflight} = State,
{ok, NewState} ->
retry_inflight(NewState, T);
{error, Reason} ->
?ERROR("Inflight retry failed\n~p", [Reason]),
?LOG(error, "Inflight retry failed\n~p", [Reason]),
{error, State#{inflight := Inflight ++ Remain}}
end.
@ -493,7 +493,7 @@ do_send(State = #{inflight := Inflight}, QAckRef, [_ | _] = Batch) ->
batch => Batch}],
{ok, State#{inflight := NewInflight}};
{error, Reason} ->
?INFO("Batch produce failed\n~p", [Reason]),
?LOG(info, "Batch produce failed\n~p", [Reason]),
{error, State}
end.

View File

@ -1,4 +1,4 @@
%% Copyright (c) 2019 EMQ Technologies Co., Ltd. All Rights Reserved.
%% Copyright (c) 2013-2019 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.

View File

@ -1,4 +1,4 @@
%% Copyright (c) 2019 EMQ Technologies Co., Ltd. All Rights Reserved.
%% Copyright (c) 2013-2019 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@ -82,4 +82,3 @@ to_broker_msg(#{qos := QoS, dup := Dup, retain := Retain, topic := Topic,
emqx_message:make(portal, QoS, Topic, Payload))).
topic(Prefix, Topic) -> emqx_topic:prepend(Prefix, Topic).

View File

@ -1,4 +1,4 @@
%% Copyright (c) 2019 EMQ Technologies Co., Ltd. All Rights Reserved.
%% Copyright (c) 2013-2019 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@ -103,4 +103,3 @@ poke(Node) ->
Node -> ok;
{badrpc, Reason} -> {error, Reason}
end.

View File

@ -1,4 +1,4 @@
%% Copyright (c) 2019 EMQ Technologies Co., Ltd. All Rights Reserved.
%% Copyright (c) 2013-2019 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@ -15,6 +15,8 @@
-module(emqx_portal_sup).
-behavior(supervisor).
-include("logger.hrl").
-export([start_link/0, start_link/1, portals/0]).
-export([create_portal/2, drop_portal/1]).
-export([init/1]).
@ -55,6 +57,6 @@ drop_portal(Id) ->
ok ->
supervisor:delete_child(?SUP, Id);
Error ->
emqx_logger:error("[Bridge] Delete bridge failed", [Error]),
?LOG(error, "[Bridge] Delete bridge failed", [Error]),
Error
end.

View File

@ -1,5 +1,5 @@
%%%===================================================================
%%% Copyright (c) 2013-2013-2019 EMQ Inc. All rights reserved.
%%% Copyright (c) 2013-2019 EMQ Inc. All rights reserved.
%%%
%%% Licensed under the Apache License, Version 2.0 (the "License");
%%% you may not use this file except in compliance with the License.
@ -90,7 +90,7 @@ case1_protocol_name(_) ->
{ok, ?CONNACK_PACKET(?CONNACK_PROTO_VER), _} = raw_recv_pase(Data),
Disconnect = gen_tcp:recv(Sock, 0),
?assertEqual({error, closed}, Disconnect).
case2_protocol_ver(_) ->
{ok, Sock} = emqx_client_sock:connect({127,0,0,1}, 1883, [binary, {packet, raw}, {active, false}], 3000),
Packet = serialize(?CASE2_PROTOCAL_VER),

View File

@ -1,4 +1,4 @@
%% Copyright (c) 2019 EMQ Technologies Co., Ltd. All Rights Reserved.
%% Copyright (c) 2013-2019 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.

View File

@ -1,4 +1,4 @@
%% Copyright (c) 2019 EMQ Technologies Co., Ltd. All Rights Reserved.
%% Copyright (c) 2013-2019 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.

View File

@ -1,4 +1,4 @@
%% Copyright (c) 2019 EMQ Technologies Co., Ltd. All Rights Reserved.
%% Copyright (c) 2013-2019 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.

View File

@ -1,4 +1,4 @@
%% Copyright (c) 2019 EMQ Technologies Co., Ltd. All Rights Reserved.
%% Copyright (c) 2013-2019 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%--------------------------------------------------------------------
%% Copyright (c) 2013-2013-2019 EMQ Enterprise, Inc. (http://emqtt.io)
%% Copyright (c) 2013-2019 EMQ Enterprise, Inc. (http://emqtt.io)
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.