File add-jc_log.hrl-replace-lager-debug-2-to-DEBUG-2.patch of Package jc

diff -Ndurp jc/src/jc_analyzer.erl jc-debug/src/jc_analyzer.erl
--- jc/src/jc_analyzer.erl	2016-09-07 15:51:56.000000000 +0300
+++ jc-debug/src/jc_analyzer.erl	2018-11-29 01:46:22.297814655 +0200
@@ -27,6 +27,7 @@
 	 terminate/2, 
 	 code_change/3]).
 
+-include("jc_log.hrl").
 
 % Record and type definitions.
 -include("../include/records.hrl").   
@@ -139,8 +140,8 @@ handle_cast(Msg, State) ->
 %%
 -spec handle_info(any(), #jc_analyzer_state{}) -> {noreply, #jc_analyzer_state{}}.
 
-handle_info({'DOWN', _Mon, _Type, Obj, Info}, State) ->
-    lager:debug("~p:  master down at ~p with ~p.", [?SERVER, Obj, Info]),
+handle_info({'DOWN', _Mon, _Type, _Obj, _Info}, State) ->
+    ?DEBUG("~p:  master down at ~p with ~p.", [?SERVER, _Obj, _Info]),
     grab_name(),
     {noreply, State};
 
@@ -209,7 +210,7 @@ update_stat(Map, Path, #jc_analyzer_stat
 
     case mnesia:dirty_read(auto_index, {Map, Path}) of
 	[] -> % no records exists, create it.
-	    lager:debug("~p: initiating tracking of ~p.", 
+	    ?DEBUG("~p: initiating tracking of ~p.", 
 			[?SERVER, {Map, Path}]),
 	    mnesia:dirty_write(#auto_index{map_path = {Map, Path},
 					   count = 1,
@@ -243,7 +244,7 @@ initiate_index(#auto_index{count = C, ti
     {Success, Msg} = 
 	case jc_store:create_index(Map, Path) of
 	    ok ->
-		lager:debug("~p: initiating index on ~p.", 
+		?DEBUG("~p: initiating index on ~p.", 
 			    [?SERVER, {Map, Path}]),
 		{true, none};
 	    {error, E} ->
@@ -263,12 +264,9 @@ initiate_index(#auto_index{count = C, ti
 % Remove all times, T,  such that now - T > WindowSize. What's left is the new 
 % count.
 %
-slide_window(#auto_index{times = T} = R, NowSecs, Map, Path, Window) ->
-    lager:debug("~p: increment count and slidinf window on ~p.", 
-		[?SERVER, {Map, Path}]),
-    
+slide_window(#auto_index{times = T} = R, NowSecs, _Map, _Path, Window) ->
+    ?DEBUG("~p: increment count and slidinf window on ~p.", [?SERVER, {_Map, _Path}]),
     NewTimes = cull(lists:sort([NowSecs|T]), NowSecs, Window),
-    
     case NewTimes of
 	[] ->
 	    mnesia:dirty_delete_object(R);
@@ -295,14 +293,10 @@ cull(Ts, _NowSecs, _Window) ->
 % then the time allowed (the Window). 
 %%
 clean(Window) ->
-    lager:debug("~p: cleaning auto_index table.", [?MODULE]),
+    ?DEBUG("~p: cleaning auto_index table.", [?MODULE]),
     NowSecs = calendar:datetime_to_gregorian_seconds(calendar:universal_time()),
     QH = qlc:q([R || R <- mnesia:table(auto_index),
 		     R#auto_index.indexed == false,
 		     (NowSecs - R#auto_index.last) >  Window]),
-
-    Records = [mnesia:dirty_delete_object(R) || 
-		  R <- mnesia:async_dirty(fun() -> qlc:e(QH) end)],
-
-    lager:debug("~p: deleted ~p records from auto_index table.",
-		[?MODULE, length(Records)]).
+    _Records = [mnesia:dirty_delete_object(R) || R <- mnesia:async_dirty(fun() -> qlc:e(QH) end)],
+    ?DEBUG("~p: deleted ~p records from auto_index table.", [?MODULE, length(_Records)]).
diff -Ndurp jc/src/jc.erl jc-debug/src/jc.erl
--- jc/src/jc.erl	2018-11-29 01:40:09.250705057 +0200
+++ jc-debug/src/jc.erl	2018-11-29 01:40:31.610172190 +0200
@@ -50,6 +50,8 @@
 % Used by eviction manager to evict an entry based on a reference
 -export ([delete_record_by_ref/1]).
 
+-include("jc_log.hrl").
+
 % definitions of global records and types.
 -include("../include/records.hrl").
 
@@ -171,7 +173,7 @@ put(Map, Key, Value) ->
 						{error, badarg}.
 
 put(Map, Key, Value, TTL) when ?VALID(TTL) ->
-    lager:debug("~p: put (~p, ~p) with TTL: ~p.", [?MODULE, Map, Key, TTL]),
+    ?DEBUG("~p: put (~p, ~p) with TTL: ~p.", [?MODULE, Map, Key, TTL]),
 
     Ref = make_ref(),
     F = fun() -> jc_store:put(Map, Key, Value, TTL, Ref) end,
@@ -201,7 +203,7 @@ put_all(Map, KVList) ->
 						   {error, badarg}.
 
 put_all(Map, KVList, TTL) when ?VALID(TTL) ->
-    lager:debug("~p: put_all for map ~p with TTL: ~p.", [?MODULE, Map, TTL]),
+    ?DEBUG("~p: put_all for map ~p with TTL: ~p.", [?MODULE, Map, TTL]),
 
     Results = [put(Map, Key, Value, TTL) || {Key, Value} <- KVList],
     {ok, length([K || {ok, K} <- Results])};
@@ -221,7 +223,7 @@ put_all(_m, _K, _T) ->
 -spec clear(map_name()) -> ok.
 
 clear(Map) ->
-    lager:debug("~p: clear map ~p.", [?MODULE, Map]),
+    ?DEBUG("~p: clear map ~p.", [?MODULE, Map]),
     F = fun() -> jc_store:clear(Map) end,
     trans_execute(F),
     ok.
@@ -233,7 +235,7 @@ clear(Map) ->
 -spec evict(map_name(), key()) -> ok.
 
 evict(Map, Key) ->
-    lager:debug("~p: evict (~p, ~p).", [?MODULE, Map, Key]),
+    ?DEBUG("~p: evict (~p, ~p).", [?MODULE, Map, Key]),
     F = fun() -> jc_store:evict(Map, Key) end,
     trans_execute(F),
     ok.
@@ -249,7 +251,7 @@ evict(Map, Key) ->
 -spec evict_match(map_name(), Criteria::string()) ->  ok.
 
 evict_match(Map, Criteria) ->
-    lager:debug("~p: evict_match with map: ~p, and criteria: ~p.", 
+    ?DEBUG("~p: evict_match with map: ~p, and criteria: ~p.", 
 		[?MODULE, Map, Criteria]),
     Fun = fun(M, K, _, Acc) ->  evict(M, K), Acc end,
     fun_match(Map, Criteria, Fun),
@@ -266,7 +268,7 @@ evict_match(Map, Criteria) ->
 -spec evict_all_match(Criteria::string()) ->  ok.
 
 evict_all_match(Criteria) ->
-    lager:debug("~p: evict_all_match ~p.", [?MODULE, Criteria]),
+    ?DEBUG("~p: evict_all_match ~p.", [?MODULE, Criteria]),
     {maps, Maps} = maps(),
     _ = [evict_match(M, Criteria) || M <- Maps],
     ok.
@@ -280,7 +282,7 @@ evict_all_match(Criteria) ->
 -spec evict_map_since(map_name(), AgeSecs::seconds()) -> ok.
 
 evict_map_since(Map, AgeSecs) when is_integer(AgeSecs) ->
-    lager:debug("~p: evict_map_since: ~p older than ~p.",
+    ?DEBUG("~p: evict_map_since: ~p older than ~p.",
 		[?MODULE, Map, AgeSecs]),
     Trans = fun() ->
 		    Recs = jc_store:get_map_since(Map, AgeSecs),
@@ -299,7 +301,7 @@ evict_map_since(_Map, _AgeSecs) ->
 -spec delete_record_by_ref(rec_ref()) -> ok | {error, mnesia_abort}.
 
 delete_record_by_ref(RecRef) ->
-    lager:debug("~p: delete_record_by_ref: ~p.",[?MODULE, RecRef]),
+    ?DEBUG("~p: delete_record_by_ref: ~p.",[?MODULE, RecRef]),
     F = fun() -> jc_store:delete_record_by_ref(RecRef) end,
     trans_execute(F).
 
@@ -329,10 +331,10 @@ flush(_) ->
 do_flush(Type)->
     F = case Type of
 	silent ->
-	    lager:debug("~p: courtesy flush.", [?MODULE]),
+	    ?DEBUG("~p: courtesy flush.", [?MODULE]),
 		fun() -> jc_store:flush(silent) end;
 	    _ ->
-		lager:debug("~p: flush.", [?MODULE]),
+		?DEBUG("~p: flush.", [?MODULE]),
 		fun() -> jc_store:flush(loud) end
 	end,
     trans_execute(F),
@@ -345,7 +347,7 @@ do_flush(Type)->
 -spec remove_items(Map::map_name(), Keys::[key()]) -> {ok, [{key(), value()}]}.
 
 remove_items(Map, Keys)->
-    lager:debug("~p: remove_items (~p, ~p).",[?MODULE, Map, Keys]),
+    ?DEBUG("~p: remove_items (~p, ~p).",[?MODULE, Map, Keys]),
 
     F = fun(Key, Acc) ->
 		case jc_store:get(Map, Key) of
@@ -388,7 +390,7 @@ contains_key(Map, Key) ->
 -spec get(map_name(), key()) -> {ok, value()} | miss.
 
 get(Map, Key) ->
-    lager:debug("~p: get (~p, ~p).",[?MODULE, Map, Key]),
+    ?DEBUG("~p: get (~p, ~p).",[?MODULE, Map, Key]),
 
     F = fun() -> jc_store:get(Map, Key) end,
     case trans_execute(F) of
@@ -406,7 +408,7 @@ get(Map, Key) ->
 -spec get_all(map_name, [key()]) -> {ok, {[{key(), value()}], [key()]}}.
 
 get_all(Map, Keys)->
-    lager:debug("~p: get_all (~p, ~p).",[?MODULE, Map, Keys]),
+    ?DEBUG("~p: get_all (~p, ~p).",[?MODULE, Map, Keys]),
     F = fun(Key, {Hits, Misses}) ->
 		case jc_store:get(Map, Key) of
 		    {ok, #key_to_value{value=Value}} ->
@@ -424,7 +426,7 @@ get_all(Map, Keys)->
 -spec key_set(Map::map_name()) -> {ok, Result::list(key())}.
 
 key_set(Map) ->
-    lager:debug("~p: key_set for ~p.",[?MODULE, Map]),
+    ?DEBUG("~p: key_set for ~p.",[?MODULE, Map]),
     F = fun() -> jc_store:key_set(Map) end,
     trans_execute(F).
 
@@ -435,7 +437,7 @@ key_set(Map) ->
 -spec values(Map::map_name()) ->  {ok, [value()]}.
 
 values(Map) ->
-    lager:debug("~p: values for ~p.",[?MODULE, Map]),
+    ?DEBUG("~p: values for ~p.",[?MODULE, Map]),
     {ok, Recs} = trans_execute(fun() -> jc_store:get_map(Map) end),
 
     F = fun(#key_to_value{value=Value}, Acc) -> [Value | Acc] end,
@@ -451,7 +453,7 @@ values(Map) ->
 -spec values_match(map_name(), Criteria::string()) ->  {ok, [{key(), value()}]}.
 
 values_match(Map, Criteria) -> 
-    lager:debug("~p: values_match ~p with  ~p.", [?MODULE, Map, Criteria]),
+    ?DEBUG("~p: values_match ~p with  ~p.", [?MODULE, Map, Criteria]),
     Fun = fun(_M, K, V, Acc) -> [{K, V} | Acc] end,
     fun_match(Map, Criteria, Fun).
 
diff -Ndurp jc/src/jc_eviction_manager.erl jc-debug/src/jc_eviction_manager.erl
--- jc/src/jc_eviction_manager.erl	2016-09-07 15:51:56.000000000 +0300
+++ jc-debug/src/jc_eviction_manager.erl	2018-11-29 01:51:41.262208485 +0200
@@ -42,6 +42,7 @@
 % Internal function used in spawn.
 -export([handle_max_ttl/1]).
 
+-include("jc_log.hrl").
 
  % Table and record definitions.
 -include("../include/records.hrl").   
@@ -71,7 +72,7 @@ add_timer(?INFINITY, _KVRecRef) ->
     ok;
 
 add_timer(TTLSecs, KVRecRef) ->
-    lager:debug("~p: adding TTL for the record with reference ~p.",
+    ?DEBUG("~p: adding TTL for the record with reference ~p.",
 		[?MODULE, KVRecRef]),
     TTLMsecs = TTLSecs * 1000,
     Ref = erlang:send_after(TTLMsecs, ?MODULE, {evict, KVRecRef}),
@@ -91,7 +92,7 @@ add_timer(TTLSecs, KVRecRef) ->
 cancel_timer(RecRef) ->
     case mnesia:dirty_read({ttl, RecRef}) of 
 	[#ttl{timer_ref = Timer} = Rec] ->
-	    lager:debug("~p: cancelling TTL for record ~p and timer ~p.",
+	    ?DEBUG("~p: cancelling TTL for record ~p and timer ~p.",
 			[?MODULE, RecRef, Timer]),
 	    Result = erlang:cancel_timer(Timer),
 	    mnesia:dirty_delete_object(Rec),
@@ -109,12 +110,12 @@ cancel_timer(RecRef) ->
 -spec set_max_ttl(Map::map_name(), Secs::seconds()) -> ok | {error, badarg}.
 
 set_max_ttl(Map, ?INFINITY) ->
-    lager:debug("~p: removing max ttl from map ~p.", [?MODULE, Map]),
+    ?DEBUG("~p: removing max ttl from map ~p.", [?MODULE, Map]),
     mnesia:dirty_delete({max_ttl, Map}),
     ok;
 
 set_max_ttl(Map, Secs) when is_integer(Secs) andalso Secs > 0->
-    lager:debug("~p: updating max ttl for map ~p to ~p.", [?MODULE, Map, Secs]),
+    ?DEBUG("~p: updating max ttl for map ~p to ~p.", [?MODULE, Map, Secs]),
     mnesia:dirty_write(#max_ttl{map = Map, ttl_secs = Secs}),
     ok;
 
@@ -218,13 +219,12 @@ handle_cast(Msg, State) ->
 handle_info({mnesia_table_event, {delete, key_to_value, _What,
 				  [Rec], _Trx}}, State) ->
 
-    #key_to_value{map = M, key = K, ref = RecRef, ttl_secs = TTL} = Rec, 
+    #key_to_value{map = _M, key = _K, ref = RecRef, ttl_secs = TTL} = Rec,
     case TTL of
 	?INFINITY ->
 	    ok;
 	_TTL -> 
-	    lager:debug("~p: cancelling timer for {~p, ~p, ~p}.",
-			[?SERVER, M, K, RecRef]),
+	    ?DEBUG("~p: cancelling timer for {~p, ~p, ~p}.", [?SERVER, _M, _K, RecRef]),
 	    cancel_timer(RecRef)
     end,
     {noreply, State};
@@ -236,19 +236,17 @@ handle_info({mnesia_table_event, {write,
 				  Rec,
 				  OldRecs, _Trx}}, State) ->
 
-    #key_to_value{map = M, key = K, ref = RecRef, ttl_secs = TTL} = Rec,
+    #key_to_value{map = _M, key = _K, ref = RecRef, ttl_secs = TTL} = Rec,
     case TTL of
 	?INFINITY ->
 	    ok;
 	_TTL ->
-	    lager:debug("~p: adding timer for {~p, ~p, ~p}.",
-			[?SERVER, M, K, RecRef]),
+	    ?DEBUG("~p: adding timer for {~p, ~p, ~p}.", [?SERVER, _M, _K, RecRef]),
 	    add_timer(TTL, RecRef)
     end,
     case OldRecs of
 	[#key_to_value{ref=OldRef, ttl_secs=OldTTL}] when OldTTL /= ?INFINITY ->
-	    lager:debug("~p: cancelling timer, record replaced {~p, ~p, ~p}.",
-			[?SERVER, M, K, RecRef]),
+	    ?DEBUG("~p: cancelling timer, record replaced {~p, ~p, ~p}.", [?SERVER, _M, _K, RecRef]),
 	    cancel_timer(OldRef);
 	_ ->
 	    ok
@@ -267,12 +265,12 @@ handle_info({mnesia_table_event, {write,
 
 
 handle_info({max_ttl_evict, Secs}, State) ->
-    lager:debug("~p: initiating max_ttl evictions.",[?SERVER]),
+    ?DEBUG("~p: initiating max_ttl evictions.",[?SERVER]),
     _ = spawn(fun()-> jc_eviction_manager:handle_max_ttl(Secs) end),
    {noreply, State};
 
 handle_info({evict, RecRef}, State) ->
-    lager:debug("~p: eviction request for record with reference ~p.",
+    ?DEBUG("~p: eviction request for record with reference ~p.",
 		[?SERVER, RecRef]),
     handle_evict(RecRef),
     {noreply, State};
@@ -316,7 +314,7 @@ code_change(_OldVsn, State, _Extra) ->
 
 handle_max_ttl(Secs) ->
     CullFn = fun(#max_ttl{map = Map, ttl_secs = Max_Secs}, Acc) ->
-		lager:debug("~p: max_ttl evicting from map ~p, older than ~p.", 
+		?DEBUG("~p: max_ttl evicting from map ~p, older than ~p.", 
 			    [?MODULE, Map, Secs]),
 		jc:evict_map_since(Map, Max_Secs),
 		Acc
diff -Ndurp jc/src/jc_log.hrl jc-debug/src/jc_log.hrl
--- jc/src/jc_log.hrl	1970-01-01 03:00:00.000000000 +0300
+++ jc-debug/src/jc_log.hrl	2018-11-29 01:40:31.614172095 +0200
@@ -0,0 +1,5 @@
+-ifdef(JC_DEBUG).
+-define(DEBUG(F, A), lager:debug(F, A)).
+-else.
+-define(DEBUG(F, A), ok).
+-endif.
diff -Ndurp jc/src/jc_protocol.erl jc-debug/src/jc_protocol.erl
--- jc/src/jc_protocol.erl	2016-09-07 15:51:56.000000000 +0300
+++ jc-debug/src/jc_protocol.erl	2018-11-29 01:40:31.614172095 +0200
@@ -66,6 +66,8 @@
 
 -module(jc_protocol).
 
+-include("jc_log.hrl").
+
 -behaviour(gen_server).
 -behaviour(ranch_protocol).
 
@@ -284,7 +286,7 @@ handle(Data, #jc_p{acc = Acc, size = Siz
 execute(Command, #jc_p{trans=T, socket=S, connected=false} = State)->
     case evaluate(Command) of
 	open_session ->
-	    lager:debug("~p (~p): connected with version: ~p",
+	    ?DEBUG("~p (~p): connected with version: ~p",
 			[?MODULE, self(), <<"1.0">>]),
 	    T:send(S, marshal({version, <<"1.0">>})),
 	    State#jc_p{connected = true};
diff -Ndurp jc/src/jc_psub.erl jc-debug/src/jc_psub.erl
--- jc/src/jc_psub.erl	2016-09-07 15:51:56.000000000 +0300
+++ jc-debug/src/jc_psub.erl	2018-11-29 01:54:15.050540834 +0200
@@ -45,6 +45,7 @@
 	 terminate/2, 
 	 code_change/3]).
 
+-include("jc_log.hrl").
 
 -include("../include/records.hrl").
 
@@ -259,21 +260,21 @@ monitor_sups(Nodes) ->
 			 {reply, ok, #jc_psub_state{}}.
 
 handle_call({subscribe, Client, Subscription}, _From, State) ->
-    lager:debug("~p: adding subscription: ~p.",[?SERVER, Subscription]),
+    ?DEBUG("~p: adding subscription: ~p.",[?SERVER, Subscription]),
     subscribe(Client, Subscription),
     {reply, ok, State};
 
 handle_call({unsubscribe, Client, Subscription}, _From, State) ->
-    lager:debug("~p: deleting subscription: ~p.",[?SERVER, Subscription]),
+    ?DEBUG("~p: deleting subscription: ~p.",[?SERVER, Subscription]),
     unsubscribe(Client, Subscription),
     {reply, ok, State};
 
 handle_call(load,  _From, State) ->
-    lager:debug("~p: calculating load.",[?SERVER]),
+    ?DEBUG("~p: calculating load.",[?SERVER]),
     {reply, calculate_load(), State};
 
 handle_call(client_count,  _From, State) ->
-    lager:debug("~p: calculating client_count.",[?SERVER]),
+    ?DEBUG("~p: calculating client_count.",[?SERVER]),
     {reply, mnesia:table_info(ps_client, size), State};
 
 handle_call(Request,  _From, State) ->
@@ -286,8 +287,8 @@ handle_call(Request,  _From, State) ->
 %%
 -spec handle_cast(any(), #jc_psub_state{}) -> {noreply, #jc_psub_state{}}.
 
-handle_cast({topic_event, Topic, Value} = Message, State) ->
-    lager:debug("~p: topic_event: ~p.",[?SERVER, Message]),
+handle_cast({topic_event, Topic, Value} = _Message, State) ->
+    ?DEBUG("~p: topic_event: ~p.", [?SERVER, _Message]),
     broadcast_topic_event(Topic, Value),
     {noreply, State};
 
@@ -336,7 +337,7 @@ handle_info({'EXIT', From, Reason}, Stat
 
 % Time to remove any deadbeats -- clients (Pids) with no active subscriptions.
 handle_info({evict_deadbeats, IntMs}, State) ->
-    lager:debug("~p: evicting deadbeats.",[?SERVER]),
+    ?DEBUG("~p: evicting deadbeats.",[?SERVER]),
     remove_deadbeats(),
     schedule_deadbeat_eviction(IntMs),
     {noreply, State};
@@ -433,17 +434,17 @@ signal_nodedown(DownNode) ->
 %%
 
 notify_of_evict(#key_to_value{map = M, key = K}) ->
-    lager:debug("~p: broadcast evict: {~p, ~p}.", [?SERVER, M, K]),
+    ?DEBUG("~p: broadcast evict: {~p, ~p}.", [?SERVER, M, K]),
     broadcast_map_event({M, K, delete}, {M, K, delete}).
 
 
 notify_of_write(#key_to_value{map = M, key = K, value = V}) ->
-    lager:debug("~p: broadcast write: {~p, ~p}.", [?SERVER, M, K]),
+    ?DEBUG("~p: broadcast write: {~p, ~p}.", [?SERVER, M, K]),
     broadcast_map_event({M, K, write}, {M, K, write, V}).
 
 
 notify_of_delete(#key_to_value{map = Map, key = Key}) ->
-    lager:debug("~p: mnesia delete activity: {~p, ~p}.",
+    ?DEBUG("~p: mnesia delete activity: {~p, ~p}.",
 		[?SERVER, Map, Key]),
     broadcast_map_event({Map, Key, delete}, {Map, Key, delete}).
 
@@ -466,7 +467,7 @@ calculate_load()->
 -spec monitor_client(pid()) -> ok.
 
 monitor_client(Pid) ->
-    lager:debug("~p: monitoring client: ~p:", [?SERVER, Pid]),
+    ?DEBUG("~p: monitoring client: ~p:", [?SERVER, Pid]),
     
     F = fun() ->
 		case mnesia:read(ps_client, Pid) of
@@ -488,7 +489,7 @@ monitor_client(Pid) ->
 -spec demonitor_client(Client::pid()) -> true | false.
 
 demonitor_client(Pid) ->
-    lager:debug("~p: demonitoring client: ~p.", [?SERVER, Pid]),
+    ?DEBUG("~p: demonitoring client: ~p.", [?SERVER, Pid]),
 
     F = fun() ->
 		Result = case mnesia:read(ps_client, Pid) of
@@ -524,7 +525,7 @@ monitor_as_possible(Pid) ->
 %% we can removie it as a subscriber.
 %%
 subscribe(Pid, Subscription ) ->
-    lager:debug("~p: adding subscription: ~p for client: ~p.", 
+    ?DEBUG("~p: adding subscription: ~p for client: ~p.", 
 		[?SERVER, Subscription, Pid]),
 
     monitor_client(Pid),
@@ -547,7 +548,7 @@ subscribe(Pid, Subscription ) ->
 %% set of listeners to that subscription.
 %%
 unsubscribe(Pid, Subscription) ->
-    lager:debug("~p: deleting subscription: ~p for client: ~p.", 
+    ?DEBUG("~p: deleting subscription: ~p for client: ~p.", 
 		[?SERVER, Subscription, Pid]),
     F = fun() ->
 		case mnesia:read(ps_sub, Subscription) of
@@ -594,7 +595,7 @@ unsubscribe_all(Pid) when is_pid(Pid) ->
 %% for topics.
 %%
 broadcast_topic_event(Topic, Value)->
-    lager:debug("~p: broadcasting topic event.", [?SERVER]),
+    ?DEBUG("~p: broadcasting topic event.", [?SERVER]),
     Variations = topic_variations(Topic, Value),
     [broadcast_change(Variation, {topic_event,{Topic, Value}}) 
      || Variation <- Variations].
@@ -605,7 +606,7 @@ topic_variations(Topic, Value)->
 
 
 broadcast_map_event(Event, Payload)->
-    lager:debug("~p: broadcasting map event.", [?SERVER]),
+    ?DEBUG("~p: broadcasting map event.", [?SERVER]),
     Variations = map_variations(Event),
     [broadcast_change(Variation, {map_event, Payload}) || Variation <- Variations].
 
diff -Ndurp jc/src/jc_sequence.erl jc-debug/src/jc_sequence.erl
--- jc/src/jc_sequence.erl	2016-09-07 15:51:56.000000000 +0300
+++ jc-debug/src/jc_sequence.erl	2018-11-29 01:49:46.832937475 +0200
@@ -34,6 +34,8 @@
 
 -type seq() :: non_neg_integer() | -1.
 
+-include("jc_log.hrl").
+
  % Table and record definitions.
 -include("../include/records.hrl").   
 
@@ -122,9 +124,8 @@ handle_cast(Msg, State) ->
 %%
 -spec handle_info(any(), #jc_seq_state{}) -> {noreply, #jc_seq_state{}}.
 
-handle_info({'DOWN', _MonitorRef, _Type, Object, Info}, State) ->
-    lager:debug("~p: jc_sequence master at ~p went down with ~p.", 
-		 [?SERVER, Object, Info]),
+handle_info({'DOWN', _MonitorRef, _Type, _Object, _Info}, State) ->
+    ?DEBUG("~p: jc_sequence master at ~p went down with ~p.", [?SERVER, _Object, _Info]),
     grab_name(),
     {noreply, State};
 
diff -Ndurp jc/src/jc_s.erl jc-debug/src/jc_s.erl
--- jc/src/jc_s.erl	2016-09-07 15:51:56.000000000 +0300
+++ jc-debug/src/jc_s.erl	2018-11-29 01:40:31.614172095 +0200
@@ -21,7 +21,6 @@
 
 -module(jc_s).
 
-
 % Put Functions
 -export([put/4, put/5,
 	 put_all/3, put_all/4]).
@@ -35,6 +34,8 @@
 % Meta Functions
 -export([sequence/1, sequence/0]).
 
+-include("jc_log.hrl").
+
  % Record and type definitions.
 -include("../include/records.hrl").   
 
@@ -107,7 +108,7 @@ put(_Map, _Key, _Value, _Seq) ->
 
 
 put(Map, Key, Value, TTL, Seq) when ?VALID(TTL) andalso ?VALID(Seq)-> 
-    lager:debug("~p: put {~p, ~p} with TTL: ~p and seq: ~p.", 
+    ?DEBUG("~p: put {~p, ~p} with TTL: ~p and seq: ~p.", 
 		[?MODULE, Map, Key, TTL, Seq]),
 
     F = fun() -> 
@@ -160,7 +161,7 @@ put_all(_M, _K, _S) ->
 
 
 put_all(Map, KVList, TTL, Seq) when ?VALID(TTL) andalso ?VALID(Seq) ->
-    lager:debug("~p: put_all for map: ~p with TTL: ~p and seq: ~p.", 
+    ?DEBUG("~p: put_all for map: ~p with TTL: ~p and seq: ~p.", 
 		[?MODULE, Map, TTL, Seq]),
     F = fun() -> 
 		case test_set(Map, Seq) of
@@ -190,7 +191,7 @@ put_all(_M, _K, _T, _S) ->
 -spec evict(map_name(), key(), jc_sequence:seq()) -> ok | trx_ret_error().
 
 evict(Map, Key, Seq) ->
-    lager:debug("~p: evict map:~p, key: ~p, and seq: ~p.).", 
+    ?DEBUG("~p: evict map:~p, key: ~p, and seq: ~p.).", 
 		[?MODULE, Map, Key, Seq]),
 
     F = fun() ->
@@ -222,7 +223,7 @@ evict(Map, Key, Seq) ->
 			 ok | trx_ret_error().
 
 evict_match(Map, Criteria, Seq) when ?VALID(Seq) ->
-    lager:debug("~p: evict_match with map: ~p, criteria: ~p and seq: ~p.", 
+    ?DEBUG("~p: evict_match with map: ~p, criteria: ~p and seq: ~p.", 
 		[?MODULE, Map, Criteria, Seq]),
 
     F = fun() ->
@@ -264,7 +265,7 @@ do_evict_match(Map, Criteria) ->
 			     ok | trx_ret_error().
 
 evict_all_match(Criteria, Seq) when ?VALID(Seq) ->
-    lager:debug("~p: evict_all_match with ~p and seq ~p:.", 
+    ?DEBUG("~p: evict_all_match with ~p and seq ~p:.", 
 		[?MODULE, Criteria, Seq]),
 
     {maps, Maps} = jc:maps(),
@@ -285,7 +286,7 @@ evict_all_match(_C, _S) ->
 			  {ok, [{key(), value()}]} | trx_ret_error().
 
 remove_items(Map, Keys, Seq) when ?VALID(Seq) ->
-    lager:debug("~p: remove_items (~p, ~p, ~p).",[?MODULE, Map, Keys, Seq]),
+    ?DEBUG("~p: remove_items (~p, ~p, ~p).",[?MODULE, Map, Keys, Seq]),
 
     F = fun(Key, Acc) ->
 		case jc_store:get(Map, Key) of
diff -Ndurp jc/src/jc_store.erl jc-debug/src/jc_store.erl
--- jc/src/jc_store.erl	2018-11-29 01:40:09.250705057 +0200
+++ jc-debug/src/jc_store.erl	2018-11-29 01:40:31.614172095 +0200
@@ -52,6 +52,7 @@
 %% Callback used by the jc_eviction manager to delete a cached value at TTL.
 -export([delete_record_by_ref/1]).
 
+-include("jc_log.hrl").
 
  % Record and type definitions.
 -include("../include/records.hrl").   
@@ -328,11 +329,11 @@ fun_match(Map, Path, Test, Fun) ->
 try_index_match(Map, Path, Test, Fun)->
     case index_get(Map, Path, Test) of
 	undefined ->
-	    lager:debug("~p: no index values found for ~p", 
+	    ?DEBUG("~p: no index values found for ~p", 
 			[?MODULE, {Map, Path}]),
 	    undefined;
 	Recs ->
-	    lager:debug("~p: using index for ~p", [?MODULE, {Map, Path}]),
+	    ?DEBUG("~p: using index for ~p", [?MODULE, {Map, Path}]),
 	    F = fun(#key_to_value{key = K, value = V}, Acc) ->
 			Fun(Map, K, V, Acc)
 		end,
openSUSE Build Service is sponsored by