Просмотр исходного кода

per module logging and fix take_table revealed tash

Maxim Sokhatsky 11 лет назад
Родитель
Сommit
7d19cce007

+ 4 - 4
apps/server/src/api_utils.erl

@@ -38,7 +38,7 @@ to_known_record(Bin, Members) when is_binary(Bin) ->
               T
           catch
               _:_ ->
-                  ?INFO("{Bin, Members}: ~p", [{Bin, Members}]),
+                  gas:info(?MODULE,"{Bin, Members}: ~p", [{Bin, Members}]),
                   erlang:error(api_error_unknown_call)
           end,
     to_known_record(Tag, Members);
@@ -46,9 +46,9 @@ to_known_record(Bin, Members) when is_binary(Bin) ->
 to_known_record(Tag, Members0) when is_atom(Tag) ->
     try
         Names = recrunt:fields(Tag),
-%        ?INFO("Names: ~p, Members: ~p",[Names,case Members0 of null -> []; X -> X end]),
+%        gas:info(?MODULE,"Names: ~p, Members: ~p",[Names,case Members0 of null -> []; X -> X end]),
         Members = case to_proper_proplists(Members0) of null -> []; Y -> Y end,
-%        ?INFO("Members: ~p",[Members]),
+%        gas:info(?MODULE,"Members: ~p",[Members]),
         Rev = lists:map(fun(X) ->
                                 Res = proplists:get_value(X, Members),
                                 %% true = (Res =/= undefined),
@@ -58,7 +58,7 @@ to_known_record(Tag, Members0) when is_atom(Tag) ->
         list_to_tuple(List)
     catch
         _:_ ->
-            ?INFO("{Tag, Members0}: ~p", [{Tag, Members0}]),
+            gas:info(?MODULE,"{Tag, Members0}: ~p", [{Tag, Members0}]),
             erlang:error(api_error_wrong_params)
     end.
 

+ 13 - 13
apps/server/src/game_manager.erl

@@ -35,9 +35,9 @@ get_lucky_pid(Sup) ->
     [X]=game_manager:get_lucky_table(Sup),
     X#game_table.game_process.
 get_relay_pid(GameId) -> case get_tables(GameId) of [] -> undefined;
-    [#game_table{game_process = P} | _] -> ?INFO("GameRelay: ~p",[P]), P end.
+    [#game_table{game_process = P} | _] -> gas:info(?MODULE,"GameRelay: ~p",[P]), P end.
 get_relay_mod_pid(GameId) -> case get_tables(GameId) of [] -> undefined;
-    [#game_table{game_process = P, game_module = M} | _] ->  ?INFO("GameRelay: ~p",[{M,P}]), {M,P} end.
+    [#game_table{game_process = P, game_module = M} | _] ->  gas:info(?MODULE,"GameRelay: ~p",[{M,P}]), {M,P} end.
 get_relay(GameId) -> gen_server:call(?MODULE, {get_relay, GameId}).
 game_requirements(GameAtom) -> GameAtom:get_requirements().
 game_requirements(game_tavla,paired) -> paired_tavla:get_requirements();
@@ -87,9 +87,9 @@ game_sup_domain(Module, Params) ->
 
 create_game_monitor(Topic, GameFSM, Params) ->
     Sup = game_sup_domain(GameFSM, Params),
-    ?INFO("Create Root Game Process (Game Monitor2): ~p Params: ~p Sup: ~p",[GameFSM, Params,Sup]),
+    gas:info(?MODULE,"Create Root Game Process (Game Monitor2): ~p Params: ~p Sup: ~p",[GameFSM, Params,Sup]),
     RelayInit = Sup:start_game(GameFSM,[Topic,Params],Topic),
-    ?INFO("RelayInit ~p",[RelayInit]),
+    gas:info(?MODULE,"RelayInit ~p",[RelayInit]),
     RelayInit.
 
 get_lucky_table(Game) ->
@@ -119,7 +119,7 @@ get_tournament(TrnId) ->
                    [T] -> X = T#game_table.id, X;
                      _ -> []
             end,
-%    ?INFO("~w:get_tournament Table = ~p", [?MODULE, Table]),
+%    gas:info(?MODULE,"~w:get_tournament Table = ~p", [?MODULE, Table]),
     Table.
 
 
@@ -142,11 +142,11 @@ get_tournament(TrnId) ->
 %%                    end ||X<-lists:seq(1,NumberOfRooms)],
 %%     [{ok,OP1,_}|_] = OkeyPlayers,
 %%     [{ok,OP2,_}|_] = lists:reverse(OkeyPlayers),
-%%     ?INFO("Okey bot rooms runned (STRESS): ~p~n",[{OP1,OP2}]).
+%%     gas:info(?MODULE,"Okey bot rooms runned (STRESS): ~p~n",[{OP1,OP2}]).
 
 
 create_standalone_game(Game, Params, Users) ->
-    ?INFO("create_standalone_game/3 Params:~p", [Params]),
+    gas:info(?MODULE,"create_standalone_game/3 Params:~p", [Params]),
     case Game of
         game_okey ->
             #pointing_rule{quota = Quota,
@@ -269,7 +269,7 @@ create_standalone_game(Game, Params, Users) ->
 
 
 create_paired_game(Game, Params, Users) ->
-    ?INFO("create_paired_game/3 Params:~p", [Params]),
+    gas:info(?MODULE,"create_paired_game/3 Params:~p", [Params]),
     case Game of
         game_tavla ->
             #pointing_rule{quota = Quota,
@@ -330,7 +330,7 @@ create_paired_game(Game, Params, Users) ->
 
 
 create_elimination_trn(GameType, Params, Registrants) ->
-    ?INFO("create_elimination_trn/3 Params:~p", [Params]),
+    gas:info(?MODULE,"create_elimination_trn/3 Params:~p", [Params]),
     TrnId         = proplists:get_value(trn_id, Params),
     QuotaPerRound = proplists:get_value(quota_per_round, Params),
     PlayersNumber = proplists:get_value(players_number, Params),
@@ -423,7 +423,7 @@ create_elimination_trn(GameType, Params, Registrants) ->
 
 
 start_tournament(TrnId,NumberOfTournaments,NumberOfPlayers,_Quota,_Tours,_Speed,GiftIds) ->
-    ?INFO("START TOURNAMENT: ~p",[{TrnId,NumberOfTournaments,NumberOfPlayers,_Quota,_Tours,_Speed,GiftIds}]),
+    gas:info(?MODULE,"START TOURNAMENT: ~p",[{TrnId,NumberOfTournaments,NumberOfPlayers,_Quota,_Tours,_Speed,GiftIds}]),
     {ok,Tournament} = nsm_db:get(tournament,TrnId),
     RealPlayersUnsorted = nsm_tournaments:joined_users(TrnId),
 
@@ -440,7 +440,7 @@ start_tournament(TrnId,NumberOfTournaments,NumberOfPlayers,_Quota,_Tours,_Speed,
                 speed = Speed} = Tournament,
 
     RealPlayersPR = lists:keysort(#play_record.other, RealPlayersUnsorted),
-    ?INFO("Head: ~p",[hd(RealPlayersPR)]),
+    gas:info(?MODULE,"Head: ~p",[hd(RealPlayersPR)]),
     RealPlayers = [list_to_binary(Who)||#play_record{who=Who}<-RealPlayersPR, Who /= undefined],
 
 %%     Registrants = case NumberOfPlayers > length(RealPlayers) of
@@ -455,7 +455,7 @@ start_tournament(TrnId,NumberOfTournaments,NumberOfPlayers,_Quota,_Tours,_Speed,
                      true -> lists:sublist(RealPlayers, NumberOfPlayers)
                   end,
 
-    ?INFO("Registrants: ~p",[Registrants]),
+    gas:info(?MODULE,"Registrants: ~p",[Registrants]),
     OkeyTournaments =
         [begin
              Params = [{trn_id, TrnId},
@@ -472,7 +472,7 @@ start_tournament(TrnId,NumberOfTournaments,NumberOfPlayers,_Quota,_Tours,_Speed,
          end || _ <-lists:seq(1,NumberOfTournaments)],
     [{ok,OP1,_}|_] = OkeyTournaments,
     [{ok,OP2,_}|_] = lists:reverse(OkeyTournaments),
-    ?INFO("Okey tournaments runned: ~p~n",[{OP1,OP2}]),
+    gas:info(?MODULE,"Okey tournaments runned: ~p~n",[{OP1,OP2}]),
     OP1
 
    end.

+ 30 - 30
apps/server/src/game_session.erl

@@ -67,7 +67,7 @@ handle_call(Request, From, State) ->
 
 
 handle_cast({bot_session_attach, UserInfo}, State = #state{user = undefined}) ->
-%    ?INFO("bot session attach", []),
+%    gas:info(?MODULE,"bot session attach", []),
     {noreply, State#state{user = UserInfo}};
 
 handle_cast(Msg, State) ->
@@ -126,8 +126,8 @@ handle_info({'DOWN', OtherRef, process, _Object, Info} = _Msg,
             #state{games = Games, rpc = RPC} = State) ->
     case lists:keyfind(OtherRef, #participation.ref, Games) of
         #participation{} ->
-            ?INFO("The table is down: ~p", [Info]),
-            ?INFO("Closing the client and sutting down the session.", []),
+            gas:info(?MODULE,"The table is down: ~p", [Info]),
+            gas:info(?MODULE,"Closing the client and sutting down the session.", []),
             send_message_to_player(RPC, #disconnect{reason_id = <<"tableDown">>,
                                                     reason = <<"The table you are playing on is unexpectedly down.">>}),
             {stop, table_down, State};
@@ -181,27 +181,27 @@ handle_client_request(#session_attach_debug{token = Token, id = Id}, _From,
     end;
 
 handle_client_request(_, _From, #state{user = undefined} = State) ->
-    ?INFO("unknown session call", []),
+    gas:info(?MODULE,"unknown session call", []),
     {reply, {error, do_session_attach_first}, State};
 
 handle_client_request(#get_game_info{}, _From, State) ->
-    ?INFO("session get game info", []),
+    gas:info(?MODULE,"session get game info", []),
     {reply, {error, not_implemented}, State};
 
 handle_client_request(#logout{}, _From, State) ->
-    ?INFO("client requests #logout{}", []),
+    gas:info(?MODULE,"client requests #logout{}", []),
     {stop, normal, ok, State};
 
 handle_client_request(#get_player_stats{player_id = PlayerId, game_type = Game}, _From,
                       State) when is_binary(Game) ->
-    ?INFO("get player stats", []),
+    gas:info(?MODULE,"get player stats", []),
     GameModule = api_utils:gametype_to_gamemodule(api_utils:gametype_to_atom(Game)),
     Res = GameModule:get_player_stats(PlayerId),
     {reply, Res, State};
 
 handle_client_request(#chat{chat_id = GameId, message = Msg0}, _From,
                       #state{user = User, games = Games} = State) ->
-    ?INFO("chat", []),
+    gas:info(?MODULE,"chat", []),
     Msg = #chat_msg{chat = GameId, content = Msg0,
                     author_id = User#'PlayerInfo'.id,
                     author_nick = User#'PlayerInfo'.login
@@ -218,7 +218,7 @@ handle_client_request(#chat{chat_id = GameId, message = Msg0}, _From,
 handle_client_request(#social_action_msg{type=Type, initiator=P1, recipient=P2}, _From,
                       #state{user = User} = State) when User =/= undefined ->
     UserIdBin = User#'PlayerInfo'.id,
-    ?INFO("social action msg from ~p to ~p (casted by ~p)", [P1, P2, UserIdBin]),
+    gas:info(?MODULE,"social action msg from ~p to ~p (casted by ~p)", [P1, P2, UserIdBin]),
     UserId = binary_to_list(UserIdBin),
     case Type of
         ?SOCIAL_ACTION_SUBSCRIBE ->
@@ -248,7 +248,7 @@ handle_client_request(#social_action_msg{type=Type, initiator=P1, recipient=P2},
 
 handle_client_request(#social_action{} = Msg, _From,
                       #state{user = User, games = Games} = State) ->
-    ?INFO("social action", []),
+    gas:info(?MODULE,"social action", []),
     GameId = Msg#social_action.game,
     Res = #social_action_msg{type = Msg#social_action.type,
                              game = GameId,
@@ -267,7 +267,7 @@ handle_client_request(#social_action{} = Msg, _From,
 handle_client_request(#subscribe_player_rels{players = Players}, _From,
             #state{user = User, rels_notif_channel = RelsChannel,
                    rels_players = RelsPlayers, rpc = RPC} = State) ->
-    ?INFO("subscribe player relations notifications: ~p", [Players]),
+    gas:info(?MODULE,"subscribe player relations notifications: ~p", [Players]),
     UserId = User#'PlayerInfo'.id,
     UserIdStr = binary_to_list(UserId),
     %% Create subscription if we need
@@ -312,7 +312,7 @@ handle_client_request(#unsubscribe_player_rels{players = Players}, _From,
                       #state{rels_notif_channel = RelsChannel,
                              rels_players = RelsPlayers
                             } = State) ->
-    ?INFO("unsubscribe player relations notifications", []),
+    gas:info(?MODULE,"unsubscribe player relations notifications", []),
     %% Remove players from common list
     NewRelsPlayers = RelsPlayers -- Players,
 
@@ -331,18 +331,18 @@ handle_client_request(#unsubscribe_player_rels{players = Players}, _From,
 handle_client_request(#join_game{game = GameId}, _From,
                       #state{user = User, rpc = RPC, games = Games} = State) ->
     UserId = User#'PlayerInfo'.id,
-    ?INFO("join game ~p user ~p from ~p", [GameId, UserId,_From]),
+    gas:info(?MODULE,"join game ~p user ~p from ~p", [GameId, UserId,_From]),
     case get_relay(GameId, Games) of
         #participation{} ->
             {reply, {error, already_joined}, State};
         false ->
-            ?INFO("Requesting main relay info...",[]),
+            gas:info(?MODULE,"Requesting main relay info...",[]),
             case game_manager:get_relay_mod_pid(GameId) of
                 {FLMod, FLPid} ->
-                    ?INFO("Found the game: ~p. Trying to register...",[{FLMod, FLPid}]),
+                    gas:info(?MODULE,"Found the game: ~p. Trying to register...",[{FLMod, FLPid}]),
                     case FLMod:reg(FLPid, User) of
                         {ok, {RegNum, {RMod, RPid}, {TMod, TPid}}} ->
-                            ?INFO("join to game relay: ~p",[{RMod, RPid}]),
+                            gas:info(?MODULE,"join to game relay: ~p",[{RMod, RPid}]),
                             {ok, _SubscrId} = RMod:subscribe(RPid, self(), UserId, RegNum),
                             Ref = erlang:monitor(process, RPid),
                             Part = #participation{ref = Ref, game_id = GameId, reg_num = RegNum,
@@ -351,12 +351,12 @@ handle_client_request(#join_game{game = GameId}, _From,
                             Res = #'TableInfo'{}, % FIXME: The client should accept 'ok' responce
                             {reply, Res, State#state{games = [Part | State#state.games]}};
                         {error, finished} ->
-                            ?INFO("The game is finished: ~p.",[GameId]),
+                            gas:info(?MODULE,"The game is finished: ~p.",[GameId]),
                             ok = send_message_to_player(RPC, #disconnect{reason_id = <<"gameFinished">>,
                                                                          reason = null}),
                             {reply, {error, finished}, State};
                         {error, out} ->
-                            ?INFO("Out of the game: ~p.",[GameId]),
+                            gas:info(?MODULE,"Out of the game: ~p.",[GameId]),
                             ok = send_message_to_player(RPC, #disconnect{reason_id = <<"disconnected">>,
                                                                          reason = null}),
                             {reply, {error, out}, State};
@@ -376,26 +376,26 @@ handle_client_request(#join_game{game = GameId}, _From,
 
 
 handle_client_request(#game_action{game = GameId} = Msg, _From, State) ->
-%    ?INFO("game action ~p", [{GameId,Msg,_From}]),
+%    gas:info(?MODULE,"game action ~p", [{GameId,Msg,_From}]),
     Participation = get_relay(GameId, State#state.games),
     case Participation of
         false ->
             {reply, {error, game_not_found}, State};
         #participation{reg_num = RegNum, tab_pid = TPid, tab_module = TMod} ->
             UId = (State#state.user)#'PlayerInfo'.id,
-            ?INFO("PLAYER ~p MOVES ~p in GAME ~p",[UId,Msg,GameId]),
+            gas:info(?MODULE,"PLAYER ~p MOVES ~p in GAME ~p",[UId,Msg,GameId]),
             {reply, TMod:submit(TPid, RegNum, Msg), State}
     end;
 
 
 handle_client_request(#pause_game{game = GameId, action = Action}, _From, State) ->
-%    ?INFO("pause game", []),
+%    gas:info(?MODULE,"pause game", []),
 %    UId = (State#state.user)#'PlayerInfo'.id,
     Participation = get_relay(GameId, State#state.games),
-%    ?INFO("ID: ~p, pause game: ~p, my games: ~p", [UId, GameId, State#state.games]),
+%    gas:info(?MODULE,"ID: ~p, pause game: ~p, my games: ~p", [UId, GameId, State#state.games]),
     case Participation of
         false ->
-            ?INFO("A", []),
+            gas:info(?MODULE,"A", []),
             {reply, {error, game_not_found}, State};
         #participation{reg_num = RegNum, tab_pid = TPid, tab_module = TMod} ->
             Signal = case Action of
@@ -403,12 +403,12 @@ handle_client_request(#pause_game{game = GameId, action = Action}, _From, State)
                          <<"resume">> -> resume_game
                      end,
             Res = TMod:signal(TPid, RegNum, {Signal, self()}),
-            ?INFO("B. Res: ~p", [Res]),
+            gas:info(?MODULE,"B. Res: ~p", [Res]),
             {reply, Res, State}
     end;
 
 handle_client_request(Request, _From, State) ->
-    ?INFO("unrecognized client request: ~p", [Request]),
+    gas:info(?MODULE,"unrecognized client request: ~p", [Request]),
     {stop, {unknown_client_request, Request}, State}.
 
 %%===================================================================
@@ -436,14 +436,14 @@ handle_relay_message(Msg, _SubscrId, #state{rpc = RPC} = State) ->
 %% because the user for example was moved to another table.
 handle_relay_kick({rejoin, GameId}, _SubscrId,
                   #state{user = User, games = Games, rpc = RPC} = State) ->
-    ?INFO("Requesting main relay info...",[]),
+    gas:info(?MODULE,"Requesting main relay info...",[]),
     UserId = User#'PlayerInfo'.id,
     case game_manager:get_relay_mod_pid(GameId) of
         {FLMod, FLPid} ->
-            ?INFO("Found the game: ~p. Trying to register...",[{FLMod, FLPid}]),
+            gas:info(?MODULE,"Found the game: ~p. Trying to register...",[{FLMod, FLPid}]),
             case FLMod:reg(FLPid, User) of
                 {ok, {RegNum, {RMod, RPid}, {TMod, TPid}}} ->
-                    ?INFO("join to game relay: ~p",[{RMod, RPid}]),
+                    gas:info(?MODULE,"join to game relay: ~p",[{RMod, RPid}]),
                     {ok, _NewSubscrId} = RMod:subscribe(RPid, self(), UserId, RegNum),
                     Ref = erlang:monitor(process, RPid),
                     Part = #participation{ref = Ref, game_id = GameId, reg_num = RegNum,
@@ -452,12 +452,12 @@ handle_relay_kick({rejoin, GameId}, _SubscrId,
                     NewGames = lists:keyreplace(GameId, #participation.game_id, Games, Part),
                     {noreply, State#state{games = NewGames}};
                 {error, finished} ->
-                    ?INFO("The game is finished: ~p.",[GameId]),
+                    gas:info(?MODULE,"The game is finished: ~p.",[GameId]),
                     send_message_to_player(RPC, #disconnect{reason_id = <<"gameFinished">>,
                                                             reason = null}),
                     {stop, normal, State};
                 {error, out} ->
-                    ?INFO("Out of the game: ~p.",[GameId]),
+                    gas:info(?MODULE,"Out of the game: ~p.",[GameId]),
                     send_message_to_player(RPC, #disconnect{reason_id = <<"kicked">>,
                                                             reason = null}),
                     {stop, normal, State};

+ 4 - 4
apps/server/src/game_stats.erl

@@ -146,8 +146,8 @@ assign_points(RawResults, GameInfo) ->
     WinnersNum = length(Winners),
     KakushPerWinner = round((KakushWinner * PaidsNum div TotalNum) / WinnersNum),
     KakushPerLoser = KakushOther * PaidsNum div TotalNum,
-    ?INFO("GAME_STATS <~p> KakushWinner: ~p KakushOther: ~p", [GameId, KakushWinner, KakushOther]),
-    ?INFO("GAME_STATS <~p> KakushPerWinner: ~p KakushPerLoser: ~p", [GameId, KakushPerWinner, KakushPerLoser]),
+    gas:info(?MODULE,"GAME_STATS <~p> KakushWinner: ~p KakushOther: ~p", [GameId, KakushWinner, KakushOther]),
+    gas:info(?MODULE,"GAME_STATS <~p> KakushPerWinner: ~p KakushPerLoser: ~p", [GameId, KakushPerWinner, KakushPerLoser]),
     Results = [begin
                    Robot = lists:member(UserId, Bots),
                    Paid = lists:member(UserId, Paids),
@@ -156,7 +156,7 @@ assign_points(RawResults, GameInfo) ->
                    #result{player_id = user_id_to_string(UserId), robot = Robot, winner = Winner,
                            pos = Pos, kakush_points = KakushPoints, game_points = GamePoints}
                end || #raw_result{player_id = UserId, winner = Winner, pos = Pos} <- RawResults],
-    ?INFO("GAME_STATS <~p> Results: ~p", [GameId, Results]),
+    gas:info(?MODULE,"GAME_STATS <~p> Results: ~p", [GameId, Results]),
     [begin
          if not Robot ->
                 SR = #scoring_record{
@@ -202,7 +202,7 @@ assign_points(RawResults, GameInfo) ->
     GameEndRes = [{if Robot -> "robot"; true -> UserId end, Robot, Pos, KPoints, GPoints}
                   || #result{player_id = UserId, robot = Robot, pos = Pos,
                              kakush_points = KPoints, game_points = GPoints} <- Results],
-    ?INFO("GAME_STATS <~p> Notificaton: ~p", [GameId, {{GameName, GameType}, GameEndRes}]),
+    gas:info(?MODULE,"GAME_STATS <~p> Notificaton: ~p", [GameId, {{GameName, GameType}, GameEndRes}]),
     wf:send(["system", "game_ends_note"], {{GameName, GameType}, GameEndRes}).
 
 is_bot(UserId, Players) ->

+ 9 - 0
apps/server/src/gas.erl

@@ -1,9 +1,18 @@
 -module(gas).
 -compile(export_all).
 
+-define(ALLOWED, [nsg_trn_lucky,game_sessoin,game_manager]).
+
+info(Module,String, Args) ->
+    case lists:member(Module,?ALLOWED) of
+         true -> error_logger:info_msg(String, Args);
+         false -> skip end.
+
 info(String, Args) ->  error_logger:info_msg(String, Args).
 info(String) -> error_logger:info_msg(String).
+warning(Module,String, Args) -> error_logger:warning_msg(String, Args).
 warning(String, Args) -> error_logger:warning_msg(String, Args).
 warning(String) -> error_logger:warning_msg(String).
+error(Module,String, Args) -> error_logger:error_msg(String, Args).
 error(String, Args) -> error_logger:error_msg(String, Args).
 error(String) -> error_logger:error_msg(String).

+ 43 - 43
apps/server/src/nsg_trn_elimination.erl

@@ -158,7 +158,7 @@ system_request(Pid, Message, Timeout) ->
 %% ====================================================================
 
 init([GameId, Params, _Manager]) ->
-    ?INFO("TRN_ELIMINATION <~p> Init started",[GameId]),
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Init started",[GameId]),
     Registrants = get_param(registrants, Params),
     QuotaPerRound = get_param(quota_per_round, Params),
     RoundsPerTour = get_param(rounds_per_tour, Params),
@@ -175,15 +175,15 @@ init([GameId, Params, _Manager]) ->
     DemoMode = get_option(demo_mode, Params, false),
     TrnId = get_option(trn_id, Params, undefined),
 
-    [?INFO("TRN_ELIMINATION_DBG <~p> Parameter <~p> : ~p", [GameId, P, V]) ||
+    [gas:info(?MODULE,"TRN_ELIMINATION_DBG <~p> Parameter <~p> : ~p", [GameId, P, V]) ||
      {P, V} <- Params],
 
     Players = setup_players(Registrants),
     PlayersIds = get_players_ids(Players),
     TTable = ttable_init(PlayersIds),
 
-    ?INFO("TRN_ELIMINATION_DBG <~p> TTable: ~p", [GameId, TTable]),
-    ?INFO("TRN_ELIMINATION <~p> started.  Pid:~p", [GameId, self()]),
+    gas:info(?MODULE,"TRN_ELIMINATION_DBG <~p> TTable: ~p", [GameId, TTable]),
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> started.  Pid:~p", [GameId, self()]),
 
     gen_fsm:send_all_state_event(self(), go),
     {ok, ?STATE_INIT, #state{game_id = GameId,
@@ -208,7 +208,7 @@ init([GameId, Params, _Manager]) ->
 %%===================================================================
 handle_event(go, ?STATE_INIT, #state{game_id = GameId, trn_id = TrnId,
                                      game_type = GameType} = StateData) ->
-    ?INFO("TRN_ELIMINATION <~p> Received a directive to starting the tournament.", [GameId]),
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Received a directive to starting the tournament.", [GameId]),
     GProcVal = #game_table{game_type = GameType,
                            game_process = self(),
                            game_module = ?MODULE,
@@ -230,28 +230,28 @@ handle_event(go, ?STATE_INIT, #state{game_id = GameId, trn_id = TrnId,
     init_tour(1, StateData);
 
 handle_event({client_message, Message}, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_ELIMINATION <~p> Received the message from a client: ~p.", [GameId, Message]),
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Received the message from a client: ~p.", [GameId, Message]),
     handle_client_message(Message, StateName, StateData);
 
 handle_event({table_message, TableId, Message}, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_ELIMINATION <~p> Received the message from table <~p>: ~p.", [GameId, TableId, Message]),
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Received the message from table <~p>: ~p.", [GameId, TableId, Message]),
     handle_table_message(TableId, Message, StateName, StateData);
 
 handle_event(Message, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_ELIMINATION <~p> Unhandled message(event) received in state <~p>: ~p.",
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Unhandled message(event) received in state <~p>: ~p.",
           [GameId, StateName, Message]),
     {next_state, StateName, StateData}.
 
 handle_sync_event({client_request, Request}, From, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_ELIMINATION <~p> Received the request from a client: ~p.", [GameId, Request]),
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Received the request from a client: ~p.", [GameId, Request]),
     handle_client_request(Request, From, StateName, StateData);
 
 handle_sync_event({system_request, Request}, From, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_ELIMINATION <~p> Received the request from the system: ~p.", [GameId, Request]),
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Received the request from the system: ~p.", [GameId, Request]),
     handle_system_request(Request, From, StateName, StateData);
 
 handle_sync_event(Request, From, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_ELIMINATION <~p> Unhandled request(event) received in state <~p> from ~p: ~p.",
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Unhandled request(event) received in state <~p> from ~p: ~p.",
           [GameId, StateName, From, Request]),
     {reply, {error, unknown_request}, StateName, StateData}.
 
@@ -261,7 +261,7 @@ handle_info({'DOWN', MonRef, process, _Pid, _}, StateName,
             #state{game_id = GameId, tables = Tables} = StateData) ->
     case get_table_by_mon_ref(MonRef, Tables) of
         #table{id = TableId} ->
-            ?INFO("TRN_ELIMINATION <~p> Table <~p> is down. Stopping", [GameId, TableId]),
+            gas:info(?MODULE,"TRN_ELIMINATION <~p> Table <~p> is down. Stopping", [GameId, TableId]),
             %% TODO: More smart handling (failover) needed
             {stop, {one_of_tables_down, TableId}, StateData};
         not_found ->
@@ -271,7 +271,7 @@ handle_info({'DOWN', MonRef, process, _Pid, _}, StateName,
 
 handle_info({rest_timeout, TableId}, StateName,
             #state{game_id = GameId, tables = Tables, table_module = TableModule} = StateData) ->
-    ?INFO("TRN_ELIMINATION <~p> Time to start new round for table <~p>.", [GameId, TableId]),
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Time to start new round for table <~p>.", [GameId, TableId]),
     #table{pid = TablePid, state = TableState} = Table = fetch_table(TableId, Tables),
     if TableState == ?TABLE_STATE_WAITING_NEW_ROUND ->
            NewTable = Table#table{state = ?TABLE_STATE_IN_PROGRESS},
@@ -279,7 +279,7 @@ handle_info({rest_timeout, TableId}, StateName,
            send_to_table(TableModule, TablePid, start_round),
            {next_state, StateName, StateData#state{tables = NewTables}};
        true ->
-           ?INFO("TRN_ELIMINATION <~p> Don't start new round at table <~p> because it is not waiting for start.",
+           gas:info(?MODULE,"TRN_ELIMINATION <~p> Don't start new round at table <~p> because it is not waiting for start.",
                  [GameId, TableId]),
            {next_state, StateName, StateData}
     end;
@@ -287,7 +287,7 @@ handle_info({rest_timeout, TableId}, StateName,
 
 handle_info({timeout, Magic}, ?STATE_WAITING_FOR_PLAYERS,
             #state{timer_magic = Magic, game_id = GameId} = StateData) ->
-    ?INFO("TRN_ELIMINATION <~p> Time to start new turn.", [GameId]),
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Time to start new turn.", [GameId]),
     start_turn(StateData);
 
 
@@ -295,11 +295,11 @@ handle_info({timeout, Magic}, ?STATE_SHOW_SERIES_RESULT,
             #state{timer_magic = Magic, tour = Tour, tours = Tours,
                    game_id = GameId} = StateData) ->
     if Tour == Tours ->
-           ?INFO("TRN_ELIMINATION <~p> Time to finalize the tournament.", [GameId]),
+           gas:info(?MODULE,"TRN_ELIMINATION <~p> Time to finalize the tournament.", [GameId]),
            finalize_tournament(StateData);
        true ->
            NewTour = Tour + 1,
-           ?INFO("TRN_ELIMINATION <~p> Time to initialize tour <~p>.", [GameId, NewTour]),
+           gas:info(?MODULE,"TRN_ELIMINATION <~p> Time to initialize tour <~p>.", [GameId, NewTour]),
            init_tour(NewTour, StateData)
     end;
 
@@ -307,20 +307,20 @@ handle_info({timeout, Magic}, ?STATE_SHOW_SERIES_RESULT,
 handle_info({timeout, Magic}, ?STATE_FINISHED,
             #state{timer_magic = Magic, tables = Tables, game_id = GameId,
                    table_module = TableModule} = StateData) ->
-    ?INFO("TRN_ELIMINATION <~p> Time to stopping the tournament.", [GameId]),
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Time to stopping the tournament.", [GameId]),
     finalize_tables_with_disconnect(TableModule, Tables),
     {stop, normal, StateData#state{tables = [], seats = []}};
 
 
 handle_info(Message, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_ELIMINATION <~p> Unhandled message(info) received in state <~p>: ~p.",
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Unhandled message(info) received in state <~p>: ~p.",
           [GameId, StateName, Message]),
     {next_state, StateName, StateData}.
 
 %%===================================================================
 
 terminate(_Reason, _StateName, #state{game_id=GameId}=_StatData) ->
-    ?INFO("TRN_ELIMINATION <~p> Shutting down at state: <~p>. Reason: ~p",
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Shutting down at state: <~p>. Reason: ~p",
           [GameId, _StateName, _Reason]),
     ok.
 
@@ -335,7 +335,7 @@ code_change(_OldVsn, StateName, StateData, _Extra) ->
 
 
 handle_client_message(Message, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_ELIMINATION <~p> Unhandled client message received in "
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Unhandled client message received in "
           "state <~p>: ~p.", [GameId, StateName, Message]),
     {next_state, StateName, StateData}.
 
@@ -451,7 +451,7 @@ handle_table_message(TableId, {response, RequestId, Response},
     NewTabRequests = dict:erase(RequestId, TabRequests),
     case dict:find(RequestId, TabRequests) of
         {ok, ReqContext} ->
-            ?INFO("TRN_ELIMINATION <~p> The a response received from table <~p>. "
+            gas:info(?MODULE,"TRN_ELIMINATION <~p> The a response received from table <~p>. "
                   "RequestId: ~p. Request context: ~p. Response: ~p",
                   [GameId, TableId, RequestId, ReqContext, Response]),
             handle_table_response(TableId, ReqContext, Response, StateName,
@@ -464,7 +464,7 @@ handle_table_message(TableId, {response, RequestId, Response},
 
 
 handle_table_message(TableId, Message, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_ELIMINATION <~p> Unhandled table message received from table <~p> in "
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Unhandled table message received from table <~p> in "
           "state <~p>: ~p.", [GameId, TableId, StateName, Message]),
     {next_state, StateName, StateData}.
 
@@ -507,7 +507,7 @@ handle_table_message(TableId, Message, StateName, #state{game_id = GameId} = Sta
 
 handle_table_response(TableId, RequestContext, Response, StateName,
                       #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_ELIMINATION <~p> Unhandled 'table response' received from table <~p> "
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Unhandled 'table response' received from table <~p> "
           "in state <~p>. Request context: ~p. Response: ~p.",
           [GameId, TableId, StateName, RequestContext, Response]),
     {next_state, StateName, StateData}.
@@ -519,56 +519,56 @@ handle_client_request({join, User}, From, StateName,
                              seats = Seats, players=Players, tables = Tables,
                              table_module = TableModule} = StateData) ->
     #'PlayerInfo'{id = UserId, robot = _IsBot} = User,
-    ?INFO("TRN_ELIMINATION <~p> The 'Join' request received from user: ~p.", [GameId, UserId]),
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> The 'Join' request received from user: ~p.", [GameId, UserId]),
     if StateName == ?STATE_FINISHED ->
-           ?INFO("TRN_ELIMINATION <~p> The tournament is finished. "
+           gas:info(?MODULE,"TRN_ELIMINATION <~p> The tournament is finished. "
                  "Reject to join user ~p.", [GameId, UserId]),
            {reply, {error, finished}, StateName, StateData};
        true ->
            case get_player_by_user_id(UserId, Players) of
                {ok, #player{status = active, id = PlayerId}} -> %% The user is an active member of the tournament.
-                   ?INFO("TRN_ELIMINATION <~p> User ~p is an active member of the tournament. "
+                   gas:info(?MODULE,"TRN_ELIMINATION <~p> User ~p is an active member of the tournament. "
                          "Allow to join.", [GameId, UserId]),
                    [#seat{table = TableId, registered_by_table = RegByTable}] = find_seats_by_player_id(PlayerId, Seats),
                    case RegByTable of
                        false -> %% Store this request to the waiting pool
-                           ?INFO("TRN_ELIMINATION <~p> User ~p not yet regirested by the table. "
+                           gas:info(?MODULE,"TRN_ELIMINATION <~p> User ~p not yet regirested by the table. "
                                  "Add the request to the waiting pool.", [GameId, UserId]),
                            NewRegRequests = dict:store(PlayerId, From, RegRequests),
                            {next_state, StateName, StateData#state{reg_requests = NewRegRequests}};
                        _ ->
-                           ?INFO("TRN_ELIMINATION <~p> Return join response for player ~p immediately.",
+                           gas:info(?MODULE,"TRN_ELIMINATION <~p> Return join response for player ~p immediately.",
                                  [GameId, UserId]),
                            #table{relay = Relay, pid = TPid} = fetch_table(TableId, Tables),
                            {reply, {ok, {PlayerId, Relay, {TableModule, TPid}}}, StateName, StateData}
                    end;
                {ok, #player{status = eliminated}} ->
-                   ?INFO("TRN_ELIMINATION <~p> User ~p is member of the tournament but he was eliminated. "
+                   gas:info(?MODULE,"TRN_ELIMINATION <~p> User ~p is member of the tournament but he was eliminated. "
                          "Reject to join.", [GameId, UserId]),
                    {reply, {error, out}, StateName, StateData};
                error -> %% Not a member
-                   ?INFO("TRN_ELIMINATION <~p> User ~p is not a member of the tournament. "
+                   gas:info(?MODULE,"TRN_ELIMINATION <~p> User ~p is not a member of the tournament. "
                          "Reject to join.", [GameId, UserId]),
                    {reply, {error, not_allowed}, StateName, StateData}
            end
     end;
 
 handle_client_request(Request, From, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_ELIMINATION <~p> Unhandled client request received from ~p in "
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Unhandled client request received from ~p in "
           "state <~p>: ~p.", [GameId, From, StateName, Request]),
    {reply, {error, unexpected_request}, StateName, StateData}.
 
 handle_system_request(last_tour_result, _From, StateName,
                       #state{game_id = GameId, tournament_table = TTable,
                              players = Players} = StateData) ->
-    ?INFO("TRN_ELIMINATION <~p> Received request for the last tour results.", [GameId]),
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Received request for the last tour results.", [GameId]),
     {LastTourNum, TourResultsRaw} = hd(lists:reverse(lists:keysort(1, TTable))),
     TourResults = [{get_user_id(PlayerId, Players), CommonPos, Points, Status}
                    || {PlayerId, CommonPos, Points, Status} <- TourResultsRaw],
     {reply, {ok, {LastTourNum, TourResults}}, StateName, StateData};
 
 handle_system_request(Request, From, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_ELIMINATION <~p> Unhandled system request received from ~p in "
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Unhandled system request received from ~p in "
           "state <~p>: ~p.", [GameId, From, StateName, Request]),
     {reply, {error, unexpected_request}, StateName, StateData}.
 
@@ -579,7 +579,7 @@ init_tour(Tour, #state{game_id = GameId, tours_plan = Plan, tournament_table = T
                        players_per_table = PlayersPerTable, game_type = GameType,
                        game_mode = GameMode, table_module = TableModule,
                        rounds_per_tour = RoundsPerTour} = StateData) ->
-    ?INFO("TRN_ELIMINATION <~p> Initializing tour <~p>...", [GameId, Tour]),
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Initializing tour <~p>...", [GameId, Tour]),
     PlayersList = prepare_players_for_new_tour(Tour, TTable, Plan, Players),
     PrepTTable = prepare_ttable_for_tables(TTable, Players),
     UsersIds = [UserId || {_, #'PlayerInfo'{id = UserId}, _} <- PlayersList],
@@ -590,7 +590,7 @@ init_tour(Tour, #state{game_id = GameId, tours_plan = Plan, tournament_table = T
     if Tour > 1 -> finalize_tables_with_rejoin(TableModule, OldTables);
        true -> do_nothing
     end,
-    ?INFO("TRN_ELIMINATION <~p> Initializing of tour <~p> is finished. "
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Initializing of tour <~p> is finished. "
           "Waiting creating confirmations from the tours' tables...",
           [GameId, Tour]),
     {next_state, ?STATE_WAITING_FOR_TABLES, StateData#state{tables = NewTables,
@@ -605,7 +605,7 @@ init_tour(Tour, #state{game_id = GameId, tours_plan = Plan, tournament_table = T
 
 start_turn(#state{game_id = GameId, tour = Tour, tables = Tables,
                   table_module = TableModule} = StateData) ->
-    ?INFO("TRN_ELIMINATION <~p> Starting tour <~p>...", [GameId, Tour]),
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Starting tour <~p>...", [GameId, Tour]),
     TablesList = tables_to_list(Tables),
     [send_to_table(TableModule, Pid, start_round) || #table{pid = Pid} <- TablesList],
     F = fun(Table, Acc) ->
@@ -613,7 +613,7 @@ start_turn(#state{game_id = GameId, tour = Tour, tables = Tables,
         end,
     NewTables = lists:foldl(F, Tables, TablesList),
     WL = [T#table.id || T <- TablesList],
-    ?INFO("TRN_ELIMINATION <~p> Tour <~p> is started. Processing...",
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Tour <~p> is started. Processing...",
           [GameId, Tour]),
     {next_state, ?STATE_TURN_PROCESSING, StateData#state{tables = NewTables,
                                                          tables_wl = WL}}.
@@ -623,7 +623,7 @@ process_tour_result(#state{game_id = GameId, tournament_table = TTable, tours =
                            tours_plan = Plan, tour = Tour, tables_results = TablesResults,
                            players = Players, tables = Tables, trn_id = TrnId,
                            table_module = TableModule} = StateData) ->
-    ?INFO("TRN_ELIMINATION <~p> Tour <~p> is completed. Starting results processing...", [GameId, Tour]),
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Tour <~p> is completed. Starting results processing...", [GameId, Tour]),
     TourType = lists:nth(Tour, Plan),
     TourResult1 = case TourType of
                      ne -> tour_result_all(TablesResults);
@@ -648,7 +648,7 @@ process_tour_result(#state{game_id = GameId, tournament_table = TTable, tours =
                                || {UserId, Position, Points, Status} <- TourResultWithUserId],
     wf:send(["system", "tournament_tour_note"], {TrnId, Tour, Tours, TourType, TourResultWithStrUserId}),
     {TRef, Magic} = start_timer(?SHOW_SERIES_RESULT_TIMEOUT),
-    ?INFO("TRN_ELIMINATION <~p> Results processing of tour <~p> is finished. "
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Results processing of tour <~p> is finished. "
           "Waiting some time (~p secs) before continue...",
           [GameId, Tour, ?SHOW_SERIES_RESULT_TIMEOUT div 1000]),
     {next_state, ?STATE_SHOW_SERIES_RESULT, StateData#state{timer = TRef, timer_magic = Magic,
@@ -657,17 +657,17 @@ process_tour_result(#state{game_id = GameId, tournament_table = TTable, tours =
 
 finalize_tournament(#state{game_id = GameId, awards = Awards, tournament_table = TTable,
                            players = Players, trn_id = TrnId} = StateData) ->
-    ?INFO("TRN_ELIMINATION <~p> Finalizing the tournament...", [GameId]),
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Finalizing the tournament...", [GameId]),
     AwardsDistrib = awards_distribution(TTable, Awards),
     AwardsDistribUserId = [{user_id_to_string(get_user_id(PlayerId, Players)), Pos, GiftId}
                            || {PlayerId, Pos, GiftId} <- AwardsDistrib],
     [wf:send(["gifts", "user", UserId, "give_gift"], {GiftId})
        || {UserId, _Pos, GiftId} <- AwardsDistribUserId],
     %% TODO: Do we need advertise the prizes to game clients?
-    ?INFO("TRN_ELIMINATION <~p> Awards distribution: ~p", [GameId, AwardsDistribUserId]),
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> Awards distribution: ~p", [GameId, AwardsDistribUserId]),
     wf:send(["system", "tournament_ends_note"], {TrnId, AwardsDistribUserId}),
     {TRef, Magic} = start_timer(?SHOW_TOURNAMENT_RESULT_TIMEOUT),
-    ?INFO("TRN_ELIMINATION <~p> The tournament is finalized. "
+    gas:info(?MODULE,"TRN_ELIMINATION <~p> The tournament is finalized. "
           "Waiting some time (~p secs) before continue...",
           [GameId, ?SHOW_TOURNAMENT_RESULT_TIMEOUT div 1000]),
     {next_state, ?STATE_FINISHED, StateData#state{timer = TRef, timer_magic = Magic}}.

+ 30 - 30
apps/server/src/nsg_trn_lucky.erl

@@ -101,7 +101,7 @@
 %% ====================================================================
 
 start([GameId, Params]) -> %% XXX WTF?
-    ?INFO(" +++ START LUCKY"),
+    gas:info(?MODULE," +++ START LUCKY"),
     start(GameId,Params).
 
 start(GameId, Params) ->
@@ -140,7 +140,7 @@ init([GameId, Params, _Manager]) ->
     TableModule =   get_param(table_module, Params),
     BotModule =     get_param(bot_module, Params),
 
-    ?INFO("TRN_LUCKY <~p> All parameteres are read. Send the directive to start the game.", [GameId]),
+    gas:info(?MODULE,"TRN_LUCKY <~p> All parameteres are read. Send the directive to start the game.", [GameId]),
     gen_fsm:send_all_state_event(self(), go),
     {ok, ?STATE_INIT,
      #state{game_id = GameId,
@@ -156,7 +156,7 @@ init([GameId, Params, _Manager]) ->
 %%===================================================================
 handle_event(go, ?STATE_INIT, #state{game_id = GameId, game = Game, game_mode = GameMode,
                                      game_name = GameName} = StateData) ->
-    ?INFO("TRN_LUCKY <~p> Received the directive to start the game.", [GameId]),
+    gas:info(?MODULE,"TRN_LUCKY <~p> Received the directive to start the game.", [GameId]),
     DeclRec = #game_table{id = GameId,
                           game_type = Game,
                           game_mode = GameMode,
@@ -208,7 +208,7 @@ handle_info({'DOWN', MonRef, process, _Pid, _}, StateName,
                    seats = Seats, players = Players} = StateData) ->
     case get_table_by_mon_ref(MonRef, Tables) of
         #table{id = TabId, timer = TRef} ->
-            ?INFO("TRN_LUCKY <~p> Table <~p> is down. Cleaning up registeres.", [GameId, TabId]),
+            gas:info(?MODULE,"TRN_LUCKY <~p> Table <~p> is down. Cleaning up registeres.", [GameId, TabId]),
             case TRef == undefined of false -> erlang:cancel_timer(TRef); true -> skip end,
             PlayersIds =
                 [PlayerId || #seat{player_id = PlayerId} <- find_seats_with_players_for_table_id(TabId, Seats)],
@@ -225,28 +225,28 @@ handle_info({'DOWN', MonRef, process, _Pid, _}, StateName,
 
 handle_info({rest_timeout, TableId}, StateName,
             #state{game_id = GameId, tables = Tables, table_module = TableModule} = StateData) ->
-    ?INFO("TRN_LUCKY <~p> Time to start new round for table <~p>.", [GameId, TableId]),
+    gas:info(?MODULE,"TRN_LUCKY <~p> Time to start new round for table <~p>.", [GameId, TableId]),
     case get_table(TableId, Tables) of
         {ok, #table{pid = TablePid}} ->
-            ?INFO("TRN_LUCKY <~p> Initiating new round at table <~p>.", [GameId, TableId]),
+            gas:info(?MODULE,"TRN_LUCKY <~p> Initiating new round at table <~p>.", [GameId, TableId]),
             NewTables = set_table_state(TableId, ?TABLE_STATE_IN_PROGRESS, Tables),
             send_to_table(TableModule, TablePid, start_round),
             {next_state, StateName, StateData#state{tables = NewTables}};
         error -> %% If no such table ignore the timeout
-            ?INFO("TRN_LUCKY <~p> There is no table <~p>. Can't start new round for it.", [GameId, TableId]),
+            gas:info(?MODULE,"TRN_LUCKY <~p> There is no table <~p>. Can't start new round for it.", [GameId, TableId]),
             {next_state, StateName, StateData}
     end;
 
 
 handle_info(Message, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_STANDALONE <~p> Unhandled message(info) received in state <~p>: ~p.",
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Unhandled message(info) received in state <~p>: ~p.",
           [GameId, StateName, Message]),
     {next_state, StateName, StateData}.
 
 %%===================================================================
 
 terminate(_Reason, _StateName, #state{game_id=GameId}=_StatData) ->
-    ?INFO("TRN_LUCKY <~p> Shutting down at state: <~p>. Reason: ~p",
+    gas:info(?MODULE,"TRN_LUCKY <~p> Shutting down at state: <~p>. Reason: ~p",
           [GameId, _StateName, _Reason]),
     ok.
 
@@ -272,7 +272,7 @@ handle_table_message(TableId, {player_connected, PlayerId},
                      #state{game_id = GameId, seats = Seats, seats_per_table = SeatsNum,
                             tables = Tables, table_module = TableModule} = StateData)
   when is_integer(TableId), is_integer(PlayerId) ->
-    ?INFO("TRN_LUCKY <~p> The player_connected notification received from "
+    gas:info(?MODULE,"TRN_LUCKY <~p> The player_connected notification received from "
           "table <~p>. PlayerId: <~p>", [GameId, TableId, PlayerId]),
     case find_seats_by_player_id(PlayerId, Seats) of
         [#seat{seat_num = SeatNum}] ->
@@ -281,7 +281,7 @@ handle_table_message(TableId, {player_connected, PlayerId},
                 #table{state = ?TABLE_STATE_READY, pid = TabPid} ->
                     case is_all_players_connected(TableId, SeatsNum, NewSeats) of
                         true ->
-                            ?INFO("TRN_LUCKY <~p> All clients connected. Starting a game.",
+                            gas:info(?MODULE,"TRN_LUCKY <~p> All clients connected. Starting a game.",
                                   [GameId]),
                             NewTables = set_table_state(TableId, ?TABLE_STATE_IN_PROGRESS, Tables),
                             send_to_table(TableModule, TabPid, start_round),
@@ -301,17 +301,17 @@ handle_table_message(TableId, {player_connected, PlayerId},
 handle_table_message(TableId, {player_disconnected, PlayerId},
                      ?STATE_PROCESSING, #state{game_id = GameId, seats = Seats} = StateData)
   when is_integer(TableId), is_integer(PlayerId) ->
-    ?INFO("TRN_LUCKY <~p> The player_disconnected notification received from "
+    gas:info(?MODULE,"TRN_LUCKY <~p> The player_disconnected notification received from "
           "table <~p>. PlayerId: <~p>", [GameId, TableId, PlayerId]),
     case find_seats_by_player_id(PlayerId, Seats) of
         [#seat{seat_num = SeatNum, is_bot = IsBot}] ->
             case real_players_at_table(TableId, Seats) of
                 1 when not IsBot -> %% Last real player gone
-                    ?INFO("TRN_LUCKY <~p> Last real player gone from "
+                    gas:info(?MODULE,"TRN_LUCKY <~p> Last real player gone from "
                           "table <~p>. Closing the table.", [GameId, TableId]),
                     unreg_player_and_eliminate_table(PlayerId, TableId, StateData);
                 _ ->
-                    ?INFO("TRN_LUCKY <~p> Al least one real player is at table <~p>. "
+                    gas:info(?MODULE,"TRN_LUCKY <~p> Al least one real player is at table <~p>. "
                           "Starting a bot to replace free seat.", [GameId, TableId]),
                     replace_player_by_bot(PlayerId, TableId, SeatNum, StateData)
             end;
@@ -324,7 +324,7 @@ handle_table_message(TableId, {table_created, Relay}, ?STATE_PROCESSING,
                            cr_tab_requests = TCrRequests, table_module = TableModule,
                            reg_requests = RegRequests} = StateData)
   when is_integer(TableId) ->
-    ?INFO("TRN_LUCKY <~p> The <table_created> notification received from table: ~p.",
+    gas:info(?MODULE,"TRN_LUCKY <~p> The <table_created> notification received from table: ~p.",
           [GameId, TableId]),
 
     TabInitPlayers = dict:fetch(TableId, TCrRequests),
@@ -362,7 +362,7 @@ handle_table_message(TableId, {round_finished, NewScoringState, _RoundScore, _To
                      #state{game_id = GameId, tables = Tables, table_module = TableModule
                            } = StateData)
   when is_integer(TableId) ->
-    ?INFO("TRN_LUCKY <~p> The <round_finished> notification received from table: ~p.",
+    gas:info(?MODULE,"TRN_LUCKY <~p> The <round_finished> notification received from table: ~p.",
           [GameId, TableId]),
     #table{pid = TablePid} = Table = fetch_table(TableId, Tables),
     TRef = erlang:send_after(?REST_TIMEOUT, self(), {rest_timeout, TableId}),
@@ -379,7 +379,7 @@ handle_table_message(TableId, {response, RequestId, Response},
     NewTabRequests = dict:erase(RequestId, TabRequests),
     case dict:find(RequestId, TabRequests) of
         {ok, ReqContext} ->
-            ?INFO("TRN_LUCKY <~p> A response received from table <~p>. "
+            gas:info(?MODULE,"TRN_LUCKY <~p> A response received from table <~p>. "
                   "RequestId: ~p. Request context: ~p. Response: ~p",
                   [GameId, TableId, RequestId, ReqContext, Response]),
             handle_table_response(ReqContext, Response, ?STATE_PROCESSING,
@@ -422,7 +422,7 @@ handle_client_request({reg, User}, From, ?STATE_PROCESSING,
                              seats = Seats, players=Players, tables = Tables,
                              table_module = TableModule} = StateData) ->
     #'PlayerInfo'{id = UserId, robot = IsBot} = User,
-    ?INFO("TRN_LUCKY <~p> The Register request received from user: ~p.", [GameId, UserId]),
+    gas:info(?MODULE,"TRN_LUCKY <~p> The Register request received from user: ~p.", [GameId, UserId]),
     case IsBot of
         true -> %% Bots can't initiate a registration
             case get_player_id_by_user_id(UserId, Players) of
@@ -437,27 +437,27 @@ handle_client_request({reg, User}, From, ?STATE_PROCESSING,
                             {reply, {ok, {PlayerId, Relay, {TableModule, TPid}}}, ?STATE_PROCESSING, StateData}
                     end;
                 error -> %% Not registered
-                    ?INFO("TRN_LUCKY <~p> User ~p is a bot. The user not registered. "
+                    gas:info(?MODULE,"TRN_LUCKY <~p> User ~p is a bot. The user not registered. "
                               "Rejecting registration.", [GameId, UserId]),
                     {reply, {error, indy_bots_not_allowed}, ?STATE_PROCESSING, StateData}
             end;
         false -> %% Normal user
             IgnoredPlayers = [Id || #player{id = Id} <- midict:geti(UserId, user_id, Players)],
-            ?INFO("TRN_LUCKY <~p> There are no table with free seats.", [GameId]),
+            gas:info(?MODULE,"TRN_LUCKY <~p> There are no table with free seats.", [GameId]),
             case find_bot_seat_without_players(Seats, IgnoredPlayers) of
                 #seat{table = TabId, seat_num = SeatNum, player_id = OldPlayerId} ->
-                    ?INFO("TRN_LUCKY <~p> Found a seat with a bot. Replacing by the user. "
+                    gas:info(?MODULE,"TRN_LUCKY <~p> Found a seat with a bot. Replacing by the user. "
                               "UserId:~p TabId: ~p SeatNum: ~p.", [GameId, UserId, TabId, SeatNum]),
                     reg_player_with_replace(User, TabId, SeatNum, OldPlayerId, From, StateData);
                 not_found ->
-                    ?INFO("TRN_LUCKY <~p> There are no seats with bots. "
+                    gas:info(?MODULE,"TRN_LUCKY <~p> There are no seats with bots. "
                               "Creating new table for user: ~p.", [GameId, UserId]),
                     reg_player_at_new_table(User, From, StateData)
             end
     end;
 
 handle_client_request(Request, From, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_LUCKY <~p> Unhandled client request received from ~p in "
+    gas:info(?MODULE,"TRN_LUCKY <~p> Unhandled client request received from ~p in "
           "state <~p>: ~p.", [GameId, From, StateName, Request]),
     {reply, {error, unexpected_request}, StateName, StateData}.
 
@@ -472,9 +472,9 @@ reg_player_with_replace(UserInfo, TableId, SeatNum, OldPlayerId, From,
     #'PlayerInfo'{id = UserId, robot = IsBot} = UserInfo,
     NewPlayers = del_player(OldPlayerId, Players),
     NewPlayers2 = reg_player(#player{id = PlayerId, user_id = UserId, is_bot = IsBot}, NewPlayers),
-    ?INFO("TRN_LUCKY <~p> User ~p registered as player <~p>.", [GameId, UserId, PlayerId]),
+    gas:info(?MODULE,"TRN_LUCKY <~p> User ~p registered as player <~p>.", [GameId, UserId, PlayerId]),
     NewSeats = assign_seat(TableId, SeatNum, PlayerId, IsBot, false, false, Seats),
-    ?INFO("TRN_LUCKY <~p> User ~p assigned to seat <~p> of table <~p>.", [GameId, UserId, SeatNum, TableId]),
+    gas:info(?MODULE,"TRN_LUCKY <~p> User ~p assigned to seat <~p> of table <~p>.", [GameId, UserId, SeatNum, TableId]),
     NewRegRequests = dict:store(PlayerId, From, RegRequests),
     TablePid = get_table_pid(TableId, Tables),
     NewTabRequests = table_req_replace_player(TableModule, TablePid, PlayerId, UserInfo, TableId, SeatNum, TabRequests),
@@ -495,7 +495,7 @@ reg_player_at_new_table(User, From,
                               } = StateData) ->
     #'PlayerInfo'{id = UserId, robot = IsBot} = User,
     RobotsInfo = spawn_bots(GameId, BotModule, SeatsNum - 1),
-    ?INFO("TRN_LUCKY <~p> Bots for table <~p> are spawned.", [GameId, TableId]),
+    gas:info(?MODULE,"TRN_LUCKY <~p> Bots for table <~p> are spawned.", [GameId, TableId]),
     F = fun(BotInfo, {PlId,SNum}) -> {{PlId, BotInfo, SNum, _Points = 0}, {PlId + 1, SNum + 1}} end,
     {RobotsRegData, {PlayerId, SeatNum}} = lists:mapfoldl(F, {PlayerIdCounter, 1}, RobotsInfo),
 
@@ -506,21 +506,21 @@ reg_player_at_new_table(User, From,
     MonRef = erlang:monitor(process, TabPid),
     %% FIXME: Table global id should use a persistent counter
     NewTables = reg_table(TableId, TabPid, MonRef, 0, undefined, Tables),
-    ?INFO("TRN_LUCKY <~p> New table created: ~p.", [GameId, TableId]),
+    gas:info(?MODULE,"TRN_LUCKY <~p> New table created: ~p.", [GameId, TableId]),
 
     NewPlayers = reg_player(#player{id = PlayerId, user_id = UserId, is_bot = IsBot}, Players),
     F2 = fun({PlId, #'PlayerInfo'{id = UId}, _SNum, _Points}, Acc) ->
                  reg_player(#player{id = PlId, user_id = UId, is_bot = true}, Acc)
          end,
     NewPlayers2 = lists:foldl(F2, NewPlayers, RobotsRegData),
-    ?INFO("TRN_LUCKY <~p> User ~p registered as player <~p>.", [GameId, UserId, PlayerId]),
+    gas:info(?MODULE,"TRN_LUCKY <~p> User ~p registered as player <~p>.", [GameId, UserId, PlayerId]),
 
     NewSeats = assign_seat(TableId, SeatNum, PlayerId, IsBot, false, false, Seats),
     F3 = fun({PlId, _UserInfo, SNum, _Points}, Acc) ->
                  assign_seat(TableId, SNum, PlId, true, false, false, Acc)
          end,
     NewSeats2 = lists:foldl(F3, NewSeats, RobotsRegData),
-    ?INFO("TRN_LUCKY <~p> User ~p assigned to seat <~p> of table <~p>.", [GameId, UserId, SeatNum, TableId]),
+    gas:info(?MODULE,"TRN_LUCKY <~p> User ~p assigned to seat <~p> of table <~p>.", [GameId, UserId, SeatNum, TableId]),
 
     NewRegRequests = dict:store(PlayerId, From, RegRequests),
     PlayersIds = [PlayerId | [PlId || {PlId, _, _, _} <- RobotsRegData]],
@@ -652,7 +652,7 @@ lookup_bot_seat_without_players([TabId | Rest], PlayersList, Seats) ->
     TabPlayers = [Id || #seat{player_id=Id} <-
                                  midict:geti(TabId, non_free_at_tab, Seats), lists:member(Id, PlayersList)],
     if TabPlayers == [] ->
-           ?INFO("TRN_LUCKY Seats:~p", [midict:geti(TabId, table_id, Seats)]),
+           gas:info(?MODULE,"TRN_LUCKY Seats:~p", [midict:geti(TabId, table_id, Seats)]),
            hd(midict:geti(TabId, bot_at_tab, Seats));
        true -> lookup_bot_seat_without_players(Rest, PlayersList, Seats)
     end.

+ 47 - 47
apps/server/src/nsg_trn_standalone.erl

@@ -158,7 +158,7 @@ client_request(Pid, Message, Timeout) ->
 %% ====================================================================
 
 init([GameId, Params, _Manager]) ->
-    ?INFO("TRN_STANDALONE <~p> Init started.", [GameId]),
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Init started.", [GameId]),
     Registrants =   get_param(registrants, Params),
     SeatsPerTable = get_param(seats, Params),
     Game =          get_param(game, Params),
@@ -176,7 +176,7 @@ init([GameId, Params, _Manager]) ->
     BotsReplacementMode = get_param(bots_replacement_mode, Params),
     CommonParams  = get_param(common_params, Params),
 
-    ?INFO("TRN_STANDALONE <~p> All parameteres are read. Send the directive to start the game.", [GameId]),
+    gas:info(?MODULE,"TRN_STANDALONE <~p> All parameteres are read. Send the directive to start the game.", [GameId]),
     gen_fsm:send_all_state_event(self(), go),
     {ok, ?STATE_INIT, #state{game_id = GameId,
                              game = Game,
@@ -202,7 +202,7 @@ init([GameId, Params, _Manager]) ->
 handle_event(go, ?STATE_INIT, #state{game_id = GameId, game = GameType,
                                      registrants = Registrants, bot_module = BotModule,
                                      common_params = CommonParams} = StateData) ->
-    ?INFO("TRN_STANDALONE <~p> Received the directive to start the game.", [GameId]),
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Received the directive to start the game.", [GameId]),
     DeclRec = create_decl_rec(GameType, CommonParams, GameId, Registrants),
     gproc:reg({p,l,self()}, DeclRec),
     {Players, PlayerIdCounter} = setup_players(Registrants, GameId, BotModule),
@@ -211,24 +211,24 @@ handle_event(go, ?STATE_INIT, #state{game_id = GameId, game = GameType,
     init_tour(1, NewStateData);
 
 handle_event({client_message, Message}, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_STANDALONE <~p> Received the message from a client: ~p.", [GameId, Message]),
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Received the message from a client: ~p.", [GameId, Message]),
     handle_client_message(Message, StateName, StateData);
 
 handle_event({table_message, TableId, Message}, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_STANDALONE <~p> Received the message from table <~p>: ~p.", [GameId, TableId, Message]),
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Received the message from table <~p>: ~p.", [GameId, TableId, Message]),
     handle_table_message(TableId, Message, StateName, StateData);
 
 handle_event(Message, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_STANDALONE <~p> Unhandled message(event) received in state <~p>: ~p.",
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Unhandled message(event) received in state <~p>: ~p.",
           [GameId, StateName, Message]),
     {next_state, StateName, StateData}.
 
 handle_sync_event({client_request, Request}, From, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_STANDALONE <~p> Received the request from a client: ~p.", [GameId, Request]),
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Received the request from a client: ~p.", [GameId, Request]),
     handle_client_request(Request, From, StateName, StateData);
 
 handle_sync_event(Request, From, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_STANDALONE <~p> Unhandled request(event) received in state <~p> from ~p: ~p.",
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Unhandled request(event) received in state <~p> from ~p: ~p.",
           [GameId, StateName, From, Request]),
     {reply, {error, unknown_request}, StateName, StateData}.
 
@@ -238,7 +238,7 @@ handle_info({'DOWN', MonRef, process, _Pid, _}, StateName,
             #state{game_id = GameId, tables = Tables} = StateData) ->
     case get_table_by_mon_ref(MonRef, Tables) of
         #table{id = TableId} ->
-            ?INFO("TRN_STANDALONE <~p> Table <~p> is down. Stopping", [GameId, TableId]),
+            gas:info(?MODULE,"TRN_STANDALONE <~p> Table <~p> is down. Stopping", [GameId, TableId]),
             %% TODO: More smart handling (failover) needed
             {stop, {one_of_tables_down, TableId}, StateData};
         not_found ->
@@ -252,18 +252,18 @@ handle_info({rest_timeout, TableId}, ?STATE_SET_PROCESSING = StateName,
                    players = Players, seats = Seats, cur_table = TableId, bot_module = BotModule,
                    player_id_counter = PlayerIdCounter, tab_requests = Requests,
                    table_module = TableMod, common_params = CommonParams} = StateData) ->
-    ?INFO("TRN_STANDALONE <~p> Time to start new round for table <~p>.", [GameId, TableId]),
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Time to start new round for table <~p>.", [GameId, TableId]),
     Disconnected = find_disconnected_players(TableId, Seats),
     ConnectedRealPlayers = [PlayerId || #player{id = PlayerId, is_bot = false} <- players_to_list(Players),
                                         not lists:member(PlayerId, Disconnected)],
     case ConnectedRealPlayers of
         [] -> %% Finish game
-            ?INFO("TRN_STANDALONE <~p> No real players left in table <~p>. "
+            gas:info(?MODULE,"TRN_STANDALONE <~p> No real players left in table <~p>. "
                   "Stopping the game.", [GameId, TableId]),
             finalize_tables_with_disconnect(TableMod, Tables),
             {stop, normal, StateData#state{tables = [], seats = []}};
         _ -> %% Replace disconnected players by bots
-            ?INFO("TRN_STANDALONE <~p> Initiating new round at table <~p>.", [GameId, TableId]),
+            gas:info(?MODULE,"TRN_STANDALONE <~p> Initiating new round at table <~p>.", [GameId, TableId]),
             {Replacements, NewPlayers, NewSeats, NewPlayerIdCounter} =
                 replace_by_bots(Disconnected, GameId, BotModule, TableId, Players, Seats, PlayerIdCounter),
             #table{pid = TablePid} = Table = fetch_table(TableId, Tables),
@@ -286,15 +286,15 @@ handle_info({rest_timeout, TableId}, ?STATE_SET_FINISHED,
                    players = Players, cur_table = TableId, table_module = TableMod,
                    kakush_for_winners = KakushForWinners, kakush_for_loser = KakushForLoser,
                    win_game_points = WinGamePoints, mul_factor = MulFactor} = StateData) ->
-    ?INFO("TRN_STANDALONE <~p> Time to determinate set results (table: <~p>).", [GameId, TableId]),
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Time to determinate set results (table: <~p>).", [GameId, TableId]),
     #table{pid = TablePid} = fetch_table(TableId, Tables),
     {_, TableScore} = lists:keyfind(TableId, 1, TablesResults),
     SeriesResult = series_result(TableScore),
-    ?INFO("TRN_STANDALONE <~p> Set result: ~p", [GameId, SeriesResult]),
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Set result: ~p", [GameId, SeriesResult]),
     send_to_table(TableMod, TablePid, {show_series_result, SeriesResult}),
     Points = calc_players_prize_points(SeriesResult, KakushForWinners, KakushForLoser, WinGamePoints, MulFactor, Players),
     UsersPrizePoints = prepare_users_prize_points(Points, Players),
-    ?INFO("TRN_STANDALONE <~p> Prizes: ~p", [GameId, UsersPrizePoints]),
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Prizes: ~p", [GameId, UsersPrizePoints]),
     add_points_to_accounts(UsersPrizePoints, GameId, GameType, GameMode, MulFactor),
     EndsNotePoints = prepare_ends_note_points(SeriesResult, Points, Players),
     send_ends_note(GameName, GameType, EndsNotePoints),
@@ -305,33 +305,33 @@ handle_info({rest_timeout, TableId}, ?STATE_SET_FINISHED,
 
 handle_info({timeout, Magic}, ?STATE_WAITING_FOR_PLAYERS,
             #state{timer_magic = Magic, game_id = GameId} = StateData) ->
-    ?INFO("TRN_STANDALONE <~p> Time to start new set.", [GameId]),
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Time to start new set.", [GameId]),
     start_set(StateData);
 
 
 handle_info({timeout, Magic}, ?STATE_SHOW_SET_RESULT,
             #state{timer_magic = Magic, game_id = GameId} = StateData) ->
-    ?INFO("TRN_STANDALONE <~p> Time to finalize the game.", [GameId]),
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Time to finalize the game.", [GameId]),
     finalize_tournament(StateData);
 
 
 handle_info({timeout, Magic}, ?STATE_FINISHED,
             #state{timer_magic = Magic, tables = Tables, game_id = GameId,
                    table_module = TableMod} = StateData) ->
-    ?INFO("TRN_STANDALONE <~p> Time to stopping the game.", [GameId]),
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Time to stopping the game.", [GameId]),
     finalize_tables_with_disconnect(TableMod, Tables),
     {stop, normal, StateData#state{tables = [], seats = []}};
 
 
 handle_info(Message, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_STANDALONE <~p> Unhandled message(info) received in state <~p>: ~p.",
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Unhandled message(info) received in state <~p>: ~p.",
           [GameId, StateName, Message]),
     {next_state, StateName, StateData}.
 
 %%===================================================================
 
 terminate(_Reason, _StateName, #state{game_id=GameId}=_StatData) ->
-    ?INFO("TRN_STANDALONE <~p> Shutting down at state: <~p>. Reason: ~p",
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Shutting down at state: <~p>. Reason: ~p",
           [GameId, _StateName, _Reason]),
     ok.
 
@@ -421,13 +421,13 @@ handle_table_message(TableId, {table_created, Relay},
 handle_table_message(TableId, {round_finished, TableContext, _RoundScore, _TotalScore},
                      ?STATE_SET_PROCESSING,
                      #state{game_id = GameId, tables = Tables, table_module = TableMod} = StateData) ->
-    ?INFO("TRN_STANDALONE <~p> Round is finished (table: <~p>).", [GameId, TableId]),
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Round is finished (table: <~p>).", [GameId, TableId]),
     #table{pid = TablePid} = Table = fetch_table(TableId, Tables),
     TRef = erlang:send_after(?REST_TIMEOUT, self(), {rest_timeout, TableId}),
     NewTable = Table#table{context = TableContext, state = ?TABLE_STATE_FINISHED, timer = TRef},
     NewTables = store_table(NewTable, Tables),
     send_to_table(TableMod, TablePid, show_round_result),
-    ?INFO("TRN_STANDALONE <~p> Waiting some time (~p secs) before start of next round.",
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Waiting some time (~p secs) before start of next round.",
           [GameId, ?REST_TIMEOUT div 1000]),
     {next_state, ?STATE_SET_PROCESSING, StateData#state{tables = NewTables}};
 
@@ -435,14 +435,14 @@ handle_table_message(TableId, {round_finished, TableContext, _RoundScore, _Total
 handle_table_message(TableId, {game_finished, TableContext, _RoundScore, TableScore},
                      ?STATE_SET_PROCESSING,
                      #state{game_id = GameId, tables = Tables, table_module = TableMod} = StateData) ->
-    ?INFO("TRN_STANDALONE <~p> Last round of the set is finished (table: <~p>).", [GameId, TableId]),
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Last round of the set is finished (table: <~p>).", [GameId, TableId]),
     TablesResults = [{TableId, TableScore}],
     #table{pid = TablePid} = Table = fetch_table(TableId, Tables),
     TRef = erlang:send_after(?REST_TIMEOUT, self(), {rest_timeout, TableId}),
     NewTable = Table#table{context = TableContext, state = ?TABLE_STATE_FINISHED, timer = TRef},
     NewTables = store_table(NewTable, Tables),
     send_to_table(TableMod, TablePid, show_round_result),
-    ?INFO("TRN_STANDALONE <~p> Waiting some time (~p secs) before the set results calculation.",
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Waiting some time (~p secs) before the set results calculation.",
           [GameId, ?REST_TIMEOUT div 1000]),
     {next_state, ?STATE_SET_FINISHED, StateData#state{tables = NewTables,
                                                       tables_results = TablesResults}};
@@ -454,7 +454,7 @@ handle_table_message(TableId, {response, RequestId, Response},
     NewTabRequests = dict:erase(RequestId, TabRequests),
     case dict:find(RequestId, TabRequests) of
         {ok, ReqContext} ->
-            ?INFO("TRN_STANDALONE <~p> The a response received from table <~p>. "
+            gas:info(?MODULE,"TRN_STANDALONE <~p> The a response received from table <~p>. "
                   "RequestId: ~p. Request context: ~p. Response: ~p",
                   [GameId, TableId, RequestId, ReqContext, Response]),
             handle_table_response(TableId, ReqContext, Response, StateName,
@@ -523,51 +523,51 @@ handle_client_request({join, UserInfo}, From, StateName,
                              table_module = TableMod, cur_table = TableId,
                              bots_replacement_mode = BotsReplacementMode} = StateData) ->
     #'PlayerInfo'{id = UserId, robot = _IsBot} = UserInfo,
-    ?INFO("TRN_STANDALONE <~p> The 'Join' request received from user: ~p.", [GameId, UserId]),
+    gas:info(?MODULE,"TRN_STANDALONE <~p> The 'Join' request received from user: ~p.", [GameId, UserId]),
     if StateName == ?STATE_FINISHED ->
-           ?INFO("TRN_STANDALONE <~p> The game is finished. "
+           gas:info(?MODULE,"TRN_STANDALONE <~p> The game is finished. "
                  "Reject to join user ~p.", [GameId, UserId]),
            {reply, {error, finished}, StateName, StateData};
        true -> %% Game in progress. Find a seat for the user
            case get_player_by_user_id(UserId, Players) of
                {ok, #player{id = PlayerId}} -> %% The user is a registered member of the game (player)
-                   ?INFO("TRN_STANDALONE <~p> User ~p is a registered member of the game. "
+                   gas:info(?MODULE,"TRN_STANDALONE <~p> User ~p is a registered member of the game. "
                          "Allow to join.", [GameId, UserId]),
                    [#seat{table = TableId, registered_by_table = RegByTable}] = find_seats_by_player_id(PlayerId, Seats),
                    case RegByTable of
                        false -> %% The player is not registered by the table yet
-                           ?INFO("TRN_STANDALONE <~p> User ~p not yet regirested by the table. "
+                           gas:info(?MODULE,"TRN_STANDALONE <~p> User ~p not yet regirested by the table. "
                                  "Add the request to the waiting pool.", [GameId, UserId]),
                            NewRegRequests = dict:store(PlayerId, From, RegRequests),
                            {next_state, StateName, StateData#state{reg_requests = NewRegRequests}};
                        _ -> %% The player is registered by the table. Return the table requisites
-                           ?INFO("TRN_STANDALONE <~p> Return the join response for player ~p immediately.",
+                           gas:info(?MODULE,"TRN_STANDALONE <~p> Return the join response for player ~p immediately.",
                                  [GameId, UserId]),
                            #table{relay = Relay, pid = TPid} = fetch_table(TableId, Tables),
                            {reply, {ok, {PlayerId, Relay, {TableMod, TPid}}}, StateName, StateData}
                    end;
                error -> %% Not a member yet
-                   ?INFO("TRN_STANDALONE <~p> User ~p is not a member of the game.", [GameId, UserId]),
+                   gas:info(?MODULE,"TRN_STANDALONE <~p> User ~p is not a member of the game.", [GameId, UserId]),
                    case find_free_seats(TableId, Seats) of
                        [] when BotsReplacementMode == disabled ->
-                           ?INFO("TRN_STANDALONE <~p> No free seats for user ~p. Robots replacement is disabled. "
+                           gas:info(?MODULE,"TRN_STANDALONE <~p> No free seats for user ~p. Robots replacement is disabled. "
                                  "Reject to join.", [GameId, UserId]),
                            {reply, {error, not_allowed}, StateName, StateData};
                        [] when BotsReplacementMode == enabled ->
-                           ?INFO("TRN_STANDALONE <~p> No free seats for user ~p. Robots replacement is enabled. "
+                           gas:info(?MODULE,"TRN_STANDALONE <~p> No free seats for user ~p. Robots replacement is enabled. "
                                  "Tring to find a robot for replace.", [GameId, UserId]),
                            case find_registered_robot_seats(TableId, Seats) of
                                [] ->
-                                   ?INFO("TRN_STANDALONE <~p> No robots for replacement by user ~p. "
+                                   gas:info(?MODULE,"TRN_STANDALONE <~p> No robots for replacement by user ~p. "
                                          "Reject to join.", [GameId, UserId]),
                                    {reply, {error, not_allowed}, StateName, StateData};
                                [#seat{seat_num = SeatNum, player_id = OldPlayerId} | _] ->
-                                   ?INFO("TRN_STANDALONE <~p> There is a robot for replacement by user ~p. "
+                                   gas:info(?MODULE,"TRN_STANDALONE <~p> There is a robot for replacement by user ~p. "
                                          "Registering.", [GameId, UserId]),
                                    reg_player_with_replace(UserInfo, TableId, SeatNum, OldPlayerId, From, StateName, StateData)
                            end;
                        [#seat{seat_num = SeatNum} | _] ->
-                           ?INFO("TRN_STANDALONE <~p> There is a free seat for user ~p. "
+                           gas:info(?MODULE,"TRN_STANDALONE <~p> There is a free seat for user ~p. "
                                  "Registering.", [GameId, UserId]),
                            reg_new_player(UserInfo, TableId, SeatNum, From, StateName, StateData)
                    end
@@ -584,7 +584,7 @@ init_tour(Tour, #state{game_id = GameId, seats_per_table = SeatsPerTable,
                        params = TableParams, players = Players, table_module = TableMod,
                        table_id_counter = TableIdCounter, tables = OldTables,
                        initial_points = InitialPoints} = StateData) ->
-    ?INFO("TRN_STANDALONE <~p> Initializing tour <~p>...", [GameId, Tour]),
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Initializing tour <~p>...", [GameId, Tour]),
     PlayersList = prepare_players_for_new_tour(InitialPoints, Players),
     {NewTables, Seats, NewTableIdCounter, CrRequests} =
         setup_tables(TableMod, PlayersList, SeatsPerTable, undefined, Tour,
@@ -592,7 +592,7 @@ init_tour(Tour, #state{game_id = GameId, seats_per_table = SeatsPerTable,
     if Tour > 1 -> finalize_tables_with_rejoin(TableMod, OldTables);
        true -> do_nothing
     end,
-    ?INFO("TRN_STANDALONE <~p> Initializing of tour <~p> is finished. "
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Initializing of tour <~p> is finished. "
           "Waiting creating confirmations from the tours' tables...",
           [GameId, Tour]),
     {next_state, ?STATE_WAITING_FOR_TABLES, StateData#state{tables = NewTables,
@@ -610,7 +610,7 @@ init_tour(Tour, #state{game_id = GameId, seats_per_table = SeatsPerTable,
 start_set(#state{game_id = GameId, game = Game, game_mode = GameMode, mul_factor = MulFactor,
                  quota_per_round = Amount, tour = Tour, tables = Tables, players = Players,
                  table_module = TableMod} = StateData) ->
-    ?INFO("TRN_STANDALONE <~p> Starting tour <~p>...", [GameId, Tour]),
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Starting tour <~p>...", [GameId, Tour]),
     UsersIds = [UserId || #player{user_id = UserId, is_bot = false} <- players_to_list(Players)],
     deduct_quota(GameId, Game, GameMode, Amount, MulFactor, UsersIds),
     TablesList = tables_to_list(Tables),
@@ -620,17 +620,17 @@ start_set(#state{game_id = GameId, game = Game, game_mode = GameMode, mul_factor
         end,
     NewTables = lists:foldl(F, Tables, TablesList),
     WL = [T#table.id || T <- TablesList],
-    ?INFO("TRN_STANDALONE <~p> Tour <~p> is started. Processing...",
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Tour <~p> is started. Processing...",
           [GameId, Tour]),
     {next_state, ?STATE_SET_PROCESSING, StateData#state{tables = NewTables,
                                                         tables_wl = WL}}.
 
 
 finalize_tournament(#state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_STANDALONE <~p> Finalizing the game...", [GameId]),
+    gas:info(?MODULE,"TRN_STANDALONE <~p> Finalizing the game...", [GameId]),
     %% TODO: Real finalization needed
     {TRef, Magic} = start_timer(?SHOW_TOURNAMENT_RESULT_TIMEOUT),
-    ?INFO("TRN_STANDALONE <~p> The game is finalized. "
+    gas:info(?MODULE,"TRN_STANDALONE <~p> The game is finalized. "
           "Waiting some time (~p secs) before continue...",
           [GameId, ?SHOW_TOURNAMENT_RESULT_TIMEOUT div 1000]),
     {next_state, ?STATE_FINISHED, StateData#state{timer = TRef, timer_magic = Magic}}.
@@ -645,10 +645,10 @@ reg_player_with_replace(UserInfo, TableId, SeatNum, OldPlayerId, From, StateName
     NewPlayers = del_player(OldPlayerId, Players),
     NewPlayers2 = store_player(#player{id = PlayerId, user_id = UserId,
                                        user_info = UserInfo, is_bot = IsBot}, NewPlayers),
-    ?INFO("TRN_STANDALONE <~p> User ~p registered as player <~p>.", [GameId, UserId, PlayerId]),
+    gas:info(?MODULE,"TRN_STANDALONE <~p> User ~p registered as player <~p>.", [GameId, UserId, PlayerId]),
     NewSeats = set_seat(TableId, SeatNum, PlayerId, _Bot = false, _RegByTable = false,
                         _Connected = false, _Free = false, Seats),
-    ?INFO("TRN_STANDALONE <~p> User ~p assigned to seat <~p> of table <~p>.", [GameId, UserId, SeatNum, TableId]),
+    gas:info(?MODULE,"TRN_STANDALONE <~p> User ~p assigned to seat <~p> of table <~p>.", [GameId, UserId, SeatNum, TableId]),
     NewRegRequests = dict:store(PlayerId, From, RegRequests),
     TablePid = get_table_pid(TableId, Tables),
     NewTabRequests = table_req_replace_player(TableModule, TablePid, PlayerId, UserInfo, TableId, SeatNum, TabRequests),
@@ -686,11 +686,11 @@ reg_new_player(UserInfo, TableId, SeatNum, From, StateName,
                                    players = NewPlayers, seats = NewSeats,
                                    player_id_counter = PlayerId + 1},
     if StateName == ?STATE_EMPTY_SEATS_FILLING andalso TableIsFull ->
-           ?INFO("TRN_STANDALONE <~p> It's enough players registered to start the game. "
+           gas:info(?MODULE,"TRN_STANDALONE <~p> It's enough players registered to start the game. "
                  "Initiating the procedure.", [GameId]),
            start_set(NewStateData);
        true ->
-           ?INFO("TRN_STANDALONE <~p> Not enough players registered to start the game. "
+           gas:info(?MODULE,"TRN_STANDALONE <~p> Not enough players registered to start the game. "
                  "Waiting for more registrations.", [GameId]),
            {next_state, StateName, NewStateData}
     end.
@@ -740,7 +740,7 @@ setup_tables(TableMod, Players, SeatsPerTable, TTable, Tour, Tours, TableId, Gam
                                       (empty, SeatNum) ->
                                            {{_PlayerId = {empty, SeatNum+1}, empty_seat_userinfo(SeatNum+1), SeatNum, _Points=0}, SeatNum+1}
                                    end, 1, SPlayers),
-    ?INFO("EmptySeatsNum:~p SPlayers: ~p TPlayers:~p", [EmptySeatsNum, SPlayers, TPlayers]),
+    gas:info(?MODULE,"EmptySeatsNum:~p SPlayers: ~p TPlayers:~p", [EmptySeatsNum, SPlayers, TPlayers]),
     TableParams2 = [{players, TPlayers}, {ttable, TTable}, {tour, Tour},
                     {tours, Tours}, {parent, {?MODULE, self()}} | TableParams],
     {ok, TabPid} = spawn_table(TableMod, GameId, TableId, TableParams2),

+ 40 - 40
apps/server/src/okey/game_okey_bot.erl

@@ -44,12 +44,12 @@ init([Owner, PlayerInfo, GameId]) ->
     {ok, SPid} = game_session:start_link(self()),
     game_session:bot_session_attach(SPid, PlayerInfo),
     UId = PlayerInfo#'PlayerInfo'.id,
-    ?INFO("BOTMODULE ~p started with game_session pid ~p", [UId,SPid]),
+    gas:info(?MODULE,"BOTMODULE ~p started with game_session pid ~p", [UId,SPid]),
     {ok, #state{user = PlayerInfo, uid = UId, owner = Owner, gid = GameId, session = SPid}}.
 
 handle_call({server, Msg0}, _From, #state{uid = UId, bot = BPid} = State) ->
     Msg = flashify(Msg0),
-    ?INFO("OKEY BOT ~p: Resend message to bot process (~p): ~p",[UId, BPid, Msg0]),
+    gas:info(?MODULE,"OKEY BOT ~p: Resend message to bot process (~p): ~p",[UId, BPid, Msg0]),
     BPid ! Msg,
     {reply, ok, State};
 
@@ -61,9 +61,9 @@ handle_call({call_rpc, Msg}, From, State) ->
     proc_lib:spawn_link(fun() ->
                                 Res = try
                                           Answer = game_session:process_request(State#state.session, "OKEY BOT", Msg),
-%                            		  ?INFO("Process Request from OKEY BOT:",[]),
-%                            		  ?INFO("                      REQUEST: ~p",[Msg]),
-%                            		  ?INFO("                        REPLY: ~p",[Answer]),
+%                            		  gas:info(?MODULE,"Process Request from OKEY BOT:",[]),
+%                            		  gas:info(?MODULE,"                      REQUEST: ~p",[Msg]),
+%                            		  gas:info(?MODULE,"                        REPLY: ~p",[Answer]),
                                           {reply, Id, Answer}
                                       catch
                                           _Err:Reason ->
@@ -84,7 +84,7 @@ handle_call(get_session, _From, State) ->
 
 handle_call(Request, _From, State) ->
     Reply = ok,
-    ?INFO("unknown call: ~p", [Request]),
+    gas:info(?MODULE,"unknown call: ~p", [Request]),
     {reply, Reply, State}.
 
 handle_cast(join_game, State) ->
@@ -96,12 +96,12 @@ handle_cast(join_game, State) ->
     {noreply, State#state{bot = BPid, owner_mon = Mon}};
 
 handle_cast(Msg, State) ->
-    ?INFO("unknown cast: ~p", [Msg]),
+    gas:info(?MODULE,"unknown cast: ~p", [Msg]),
     {noreply, State}.
 
 handle_info({'DOWN', Ref, process, _, Reason},
             State = #state{owner_mon = OMon}) when OMon == Ref->
-    ?INFO
+    gas:info
     ("relay goes down with reason ~p so does bot", [Reason]),
     {stop, Reason, State};
 handle_info({server,M}, #state{uid = UId, bot = BPid} = State) ->
@@ -146,49 +146,49 @@ robot_init_loop(State) ->
     GameId = State#state.gid,
     receive
         join_game ->
-            ?INFO("OKEY BOT JOINED"),
+            gas:info(?MODULE,"OKEY BOT JOINED"),
             case call_rpc(S, #join_game{game = GameId}) of
                 {error, _Err} ->
-                    ?INFO("ID: ~p failed take with msg ~p", [Id, _Err]),
+                    gas:info(?MODULE,"ID: ~p failed take with msg ~p", [Id, _Err]),
                     erlang:error(robot_cant_join_game);
                 _ ->
                     okey_client_loop(State)
             end;
         _X ->
-           ?INFO("OKEY BOT X: ~p",[_X])
+           gas:info(?MODULE,"OKEY BOT X: ~p",[_X])
     end.
 
 okey_client_loop(State) ->
-    ?INFO("OKEY BOT CLIENT LOOP"),
+    gas:info(?MODULE,"OKEY BOT CLIENT LOOP", []),
     Hand0 = State#state.hand,
     Id = State#state.uid,
     receive
         #game_event{event = <<"okey_next_turn">>, args = Args} = Msg ->
-            ?INFO("OKEY_BOT <~p> : Received message: ~p", [Id, Msg]),
+            gas:info(?MODULE,"OKEY_BOT <~p> : Received message: ~p", [Id, Msg]),
             Hand1 = case {proplists:get_value(player, Args), proplists:get_value(can_challenge, Args)} of
                         {Id, false} ->
-                            ?INFO("OKEY NEXT TURN"),
+                            gas:info(?MODULE,"OKEY NEXT TURN"),
                             do_turn(State, Hand0);
                         {_OtherId, _Val} ->
                             Hand0
                     end,
             okey_client_loop(State#state{hand = Hand1});
         #game_event{event = <<"okey_revealed">>} = Msg ->
-            ?INFO("OKEY_BOT <~p> : Received message: ~p", [Id, Msg]),
+            gas:info(?MODULE,"OKEY_BOT <~p> : Received message: ~p", [Id, Msg]),
             do_challenge(State),
             okey_client_loop(State);
         #game_event{event = <<"okey_series_ended">>} = Msg ->
-            ?INFO("OKEY_BOT <~p> : Received message: ~p", [Id, Msg]),
+            gas:info(?MODULE,"OKEY_BOT <~p> : Received message: ~p", [Id, Msg]),
 %%            S = State#state.conn,
 %%            call_rpc(S, #logout{});
             okey_client_loop(State);
         #game_event{event = <<"okey_round_ended">>, args = Args} = Msg ->
-            ?INFO("OKEY_BOT <~p> : Received message: ~p", [Id, Msg]),
+            gas:info(?MODULE,"OKEY_BOT <~p> : Received message: ~p", [Id, Msg]),
             NextAction = proplists:get_value(next_action, Args),
-            ?INFO("ID: ~p round ended", [Id]),
+            gas:info(?MODULE,"ID: ~p round ended", [Id]),
             okey_client_round(NextAction, State);
         #game_event{event = <<"okey_game_info">>, args = Args} = Msg ->
-            ?INFO("OKEY_BOT <~p> : Received message: ~p", [Id, Msg]),
+            gas:info(?MODULE,"OKEY_BOT <~p> : Received message: ~p", [Id, Msg]),
             Mode = proplists:get_value(game_type, Args),
             SM = proplists:get_value(sets, Args),
             SC = proplists:get_value(set_no, Args),
@@ -200,20 +200,20 @@ okey_client_loop(State) ->
             ST = #'OkeySetState'{round_cur = 1, round_max = RM, set_cur = SC, set_max = SM},
             okey_client_loop(State#state{set_state = ST, delay = Delay, mode = Mode});
         #game_event{event = <<"okey_disable_okey">>, args = Args} = Msg ->
-            ?INFO("OKEY_BOT <~p> : Received message: ~p", [Id, Msg]),
+            gas:info(?MODULE,"OKEY_BOT <~p> : Received message: ~p", [Id, Msg]),
             okey_client_loop(State#state{okey_disable = true});
         #game_event{event = <<"okey_game_started">>, args = Args} = Msg ->
-            ?INFO("OKEY_BOT <~p> : Received message: ~p", [Id, Msg]),
+            gas:info(?MODULE,"OKEY_BOT <~p> : Received message: ~p", [Id, Msg]),
             MH = proplists:get_value(tiles, Args),
             G = proplists:get_value(gosterge, Args),
             RC = proplists:get_value(current_round, Args),
             ST = State#state.set_state,
             ST1 = ST#'OkeySetState'{round_cur = RC},
 %            State#state{hand = MH, gosterge = G, set_state = ST1},
-            ?INFO("OKEY BOT GAME STARTED : ~p",[length(MH)]),
+            gas:info(?MODULE,"OKEY BOT GAME STARTED : ~p",[length(MH)]),
             okey_client_loop(State#state{hand = MH, gosterge = G, set_state = ST1});
         #game_event{event = <<"okey_game_player_state">>, args = Args} = Msg ->
-            ?INFO("OKEY_BOT <~p> : Received message: ~p", [Id, Msg]),
+            gas:info(?MODULE,"OKEY_BOT <~p> : Received message: ~p", [Id, Msg]),
             SS = #'OkeySetState'{round_cur = 1, round_max = 3,
                             set_cur = 1,set_max = 1},
 
@@ -221,7 +221,7 @@ okey_client_loop(State) ->
             Turn = proplists:get_value(whos_move, Args),
             GameState = proplists:get_value(game_state, Args),
             Gosterge = State#state.gosterge,
-            ?INFO("Id ~p Turn: ~p GameState: ~p",[Id, Turn,GameState]),
+            gas:info(?MODULE,"Id ~p Turn: ~p GameState: ~p",[Id, Turn,GameState]),
 
             case Pause of
                  true -> wait_for_resume();
@@ -231,33 +231,33 @@ okey_client_loop(State) ->
 
             case {Turn, GameState} of
                 {Id, <<"do_okey_take">>} ->
-                    ?INFO("init bot: take", []),
+                    gas:info(?MODULE,"init bot: take", []),
                     Hand1 = do_turn(State, Hand0),
                     okey_client_loop(State#state{hand = Hand1, gosterge = Gosterge});
                 {Id, <<"do_okey_discard">>} ->
-                    ?INFO("init bot: discard", []),
+                    gas:info(?MODULE,"init bot: discard", []),
                     {TryDiscard, _} = draw_random(Hand0),
                     Hand1 = do_discard(State, Hand0, TryDiscard),
                     okey_client_loop(State#state{hand = Hand1, gosterge = Gosterge});
                 {_, <<"game_finished">>} ->
-                    ?INFO("init bot: finished", []),
+                    gas:info(?MODULE,"init bot: finished", []),
                      okey_client_rematch(State),
                     okey_client_loop(State);
                 {_, <<"do_okey_ready">>} ->
-                    ?INFO("init bot: ready", []),
+                    gas:info(?MODULE,"init bot: ready", []),
                     say_ready(State),
                     okey_client_round(<<"done">>, State);
                 {_, <<"do_okey_challenge">>} ->
-                    ?INFO("init bot: challenge", []),
+                    gas:info(?MODULE,"init bot: challenge", []),
                     do_challenge(State),
                     okey_client_loop(State#state{hand = Hand0, gosterge = Gosterge});
                 {_, _B} ->
-                    ?INFO("init bot: UNKNOWN ~p", [_B]),
+                    gas:info(?MODULE,"init bot: UNKNOWN ~p", [_B]),
                     okey_client_loop(State#state{hand = Hand0, gosterge = Gosterge})
             end;
 
         _Other = Msg ->
-            ?INFO("OKEY_BOT <~p> : Received unhandled message: ~p", [Id, Msg]),
+            gas:info(?MODULE,"OKEY_BOT <~p> : Received unhandled message: ~p", [Id, Msg]),
             okey_client_loop(State)
     end.
 
@@ -268,7 +268,7 @@ do_challenge(State) ->
                          game = GameId,
                          action = okey_challenge,
                          args = [ {challenge, random_bool(0.2)} ]}),
-    ?INFO("ID: ~p challenge result: ~p", [State#state.uid, ZZZ]),
+    gas:info(?MODULE,"ID: ~p challenge result: ~p", [State#state.uid, ZZZ]),
     ok.
 
 okey_client_round(<<"done">>, State = #state{}) ->
@@ -289,21 +289,21 @@ okey_client_round(<<"next_round">>, State) ->
 okey_client_rematch(State) ->
     S = State#state.conn,
     GameId = State#state.gid,
-    ?INFO("sending rematch", []),
+    gas:info(?MODULE,"sending rematch", []),
     A = call_rpc(S, #rematch{game = GameId}),
-    ?INFO("rematch result: ~p", [A]),
+    gas:info(?MODULE,"rematch result: ~p", [A]),
     ok = A,
     okey_client_rematch2(State).
 
 okey_client_rematch2(State) ->
     S = State#state.conn,
     GameId = State#state.gid,
-    ?INFO("rematch loop receive", []),
+    gas:info(?MODULE,"rematch loop receive", []),
     receive
         #game_rematched{game = GI} when GameId == GI ->
-            ?INFO("#game_rematched{game = GameId}", []);
+            gas:info(?MODULE,"#game_rematched{game = GameId}", []);
         #game_event{event = <<"player_left">>, args = Args} ->
-            ?INFO("#game_event{event = <<\"player_left\">>, args = Args}", []),
+            gas:info(?MODULE,"#game_event{event = <<\"player_left\">>, args = Args}", []),
             Replaced = proplists:get_value(bot_replaced, Args, false) orelse
                 proplists:get_value(human_replaced, Args, false),
             case Replaced of
@@ -323,14 +323,14 @@ do_turn(#state{delay = Delay} = State, Hand) ->
     Hand1 = if length(Hand) == 15 ->
                    Hand;
                true ->
-                   ?INFO("OKEY BOT TAKE ? ~p ",[length(Hand)]),
+                   gas:info(?MODULE,"OKEY BOT TAKE ? ~p ",[length(Hand)]),
                    simulate_delay(take, Delay),
                    {_, H1} = do_take(State, Hand),
                    H1
             end,
     true = is_list(Hand1),
     {TryDiscard, _} = draw_random(Hand1),
-    ?INFO("DO TURN"),
+    gas:info(?MODULE,"DO TURN"),
     simulate_delay(discard, Delay),
     do_discard(State, Hand1, TryDiscard).
 
@@ -374,7 +374,7 @@ do_take(State, Hand) ->
         {error, game_has_already_ended} when State#state.mode == <<"countdown">> ->
             {false, Hand};
         _Err ->
-            ?INFO("ID: ~p failed take with msg ~p", [Id, _Err]),
+            gas:info(?MODULE,"ID: ~p failed take with msg ~p", [Id, _Err]),
             erlang:error(failed_take),
             {false, Hand}
     end.

+ 1 - 1
apps/server/src/okey/game_okey_ng_desk.erl

@@ -359,7 +359,7 @@ handle_player_action(PlayerId, {discard, Tash}, ?STATE_DISCARD,
     if PlayerId == CurPlayerId ->
            case discard_tash(Tash, PlayerId, Players) of
                error ->
-                   ?INFO("OKEY_NG_DESK Discard error. SeatNum: ~p. Tash: ~p", [PlayerId, Tash]),
+                   gas:info(?MODULE,"OKEY_NG_DESK Discard error. SeatNum: ~p. Tash: ~p", [PlayerId, Tash]),
                    {error, no_such_tash};
                NewPlayers ->
                    Events1 = [{tash_discarded, PlayerId, Tash}],

+ 1 - 1
apps/server/src/okey/game_okey_ng_scoring.erl

@@ -76,7 +76,7 @@
 %%     RoundsNum = undefined | pos_integer()
 
 init(Mode, SeatsInfo, RoundsNum) ->
-    ?INFO("OKEY_NG_SCORING init Mode: ~p SeatsInfo = ~p RoundsNum = ~p", [Mode, SeatsInfo, RoundsNum]),
+    gas:info(?MODULE,"OKEY_NG_SCORING init Mode: ~p SeatsInfo = ~p RoundsNum = ~p", [Mode, SeatsInfo, RoundsNum]),
     true = lists:member(Mode, [?MODE_STANDARD, ?MODE_EVENODD, ?MODE_COLOR, ?MODE_COUNTDOWN]),
     true = if Mode == ?MODE_COUNTDOWN -> RoundsNum == undefined;
               true -> is_integer(RoundsNum) orelse RoundsNum == undefined end,

+ 26 - 26
apps/server/src/okey/game_okey_ng_table_trn.erl

@@ -173,9 +173,9 @@ init([GameId, TableId, Params]) ->
                    {observers_allowed, false},
                    {table, {?MODULE, self()}}],
     {ok, Relay} = ?RELAY:start(RelayParams),
-    ?INFO("OKEY_NG_TABLE_TRN_DBG <~p,~p> Set timeout: ~p, round timeout: ~p.", [GameId, TableId, SetTimeout, RoundTimeout]),
-    ?INFO("OKEY_NG_TABLE_TRN_DBG <~p,~p> PlayersInfo: ~p.", [GameId, TableId, PlayersInfo]),
-    ?INFO("OKEY_NG_TABLE_TRN <~p,~p> Started.", [GameId, TableId]),
+    gas:info(?MODULE,"OKEY_NG_TABLE_TRN_DBG <~p,~p> Set timeout: ~p, round timeout: ~p.", [GameId, TableId, SetTimeout, RoundTimeout]),
+    gas:info(?MODULE,"OKEY_NG_TABLE_TRN_DBG <~p,~p> PlayersInfo: ~p.", [GameId, TableId, PlayersInfo]),
+    gas:info(?MODULE,"OKEY_NG_TABLE_TRN <~p,~p> Started.", [GameId, TableId]),
     parent_notify_table_created(Parent, TableId, Relay),
     {ok, ?STATE_WAITING_FOR_START, #state{game_id = GameId,
                                           table_id = TableId,
@@ -210,13 +210,13 @@ init([GameId, TableId, Params]) ->
 
 handle_event({parent_message, Message}, StateName,
              #state{game_id = GameId, table_id = TableId} = StateData) ->
-    ?INFO("OKEY_NG_TABLE_TRN <~p,~p> Received message from the parent: ~p.",
+    gas:info(?MODULE,"OKEY_NG_TABLE_TRN <~p,~p> Received message from the parent: ~p.",
           [GameId, TableId, Message]),
     handle_parent_message(Message, StateName, StateData);
 
 handle_event({relay_message, Message}, StateName,
              #state{game_id = GameId, table_id = TableId} =  StateData) ->
-    ?INFO("OKEY_NG_TABLE_TRN <~p,~p> Received message from the relay: ~p.",
+    gas:info(?MODULE,"OKEY_NG_TABLE_TRN <~p,~p> Received message from the relay: ~p.",
           [GameId, TableId, Message]),
     handle_relay_message(Message, StateName, StateData);
 
@@ -238,13 +238,13 @@ handle_sync_event(_Event, _From, StateName, StateData) ->
 
 handle_info({timeout, Magic}, ?STATE_PLAYING,
             #state{timeout_magic = Magic, game_id = GameId, table_id = TableId} = StateData) ->
-    ?INFO("OKEY_NG_TABLE_TRN <~p,~p> Move timeout. Do an automatic move(s).", [GameId, TableId]),
+    gas:info(?MODULE,"OKEY_NG_TABLE_TRN <~p,~p> Move timeout. Do an automatic move(s).", [GameId, TableId]),
     do_timeout_moves(StateData);
 
 handle_info({round_timeout, Round}, ?STATE_PLAYING,
             #state{cur_round = Round, desk_state = DeskState, game_id = GameId,
                    table_id = TableId, timeout_timer = TRef} = StateData) ->
-    ?INFO("OKEY_NG_TABLE_TRN <~p,~p> Time to finish round ~p because the round timeout.", [GameId, TableId, Round]),
+    gas:info(?MODULE,"OKEY_NG_TABLE_TRN <~p,~p> Time to finish round ~p because the round timeout.", [GameId, TableId, Round]),
     if TRef =/= undefined -> erlang:cancel_timer(TRef);
        true -> do_nothing
     end,
@@ -254,7 +254,7 @@ handle_info(set_timeout, StateName,
             #state{cur_round = Round, desk_state = DeskState, game_id = GameId,
                    table_id = TableId, timeout_timer = TRef} = StateData) when
   StateName =/= ?STATE_SET_FINISHED ->
-    ?INFO("OKEY_NG_TABLE_TRN <~p,~p> Time to finish round ~p and the set because the set timeout.", [GameId, TableId, Round]),
+    gas:info(?MODULE,"OKEY_NG_TABLE_TRN <~p,~p> Time to finish round ~p and the set because the set timeout.", [GameId, TableId, Round]),
     if TRef =/= undefined -> erlang:cancel_timer(TRef);
        true -> do_nothing
     end,
@@ -263,17 +263,17 @@ handle_info(set_timeout, StateName,
 handle_info({timeout, Magic}, ?STATE_REVEAL_CONFIRMATION,
             #state{timeout_magic = Magic, wait_list = WL, game_id = GameId, table_id = TableId,
                    reveal_confirmation_list = CList} = StateData) ->
-    ?INFO("OKEY_NG_TABLE_TRN <~p,~p> Time to check reveal confirmation responses.", [GameId, TableId]),
+    gas:info(?MODULE,"OKEY_NG_TABLE_TRN <~p,~p> Time to check reveal confirmation responses.", [GameId, TableId]),
     NewCList = lists:foldl(fun(SeatNum, Acc) -> [{SeatNum, false} | Acc] end, CList, WL),
     finalize_round(StateData#state{reveal_confirmation_list = NewCList});
 
 handle_info(Info, StateName, #state{game_id = GameId, table_id = TableId} = StateData) ->
-    ?INFO("OKEY_NG_TABLE_TRN <~p,~p> Unexpected message(info) received at state <~p>: ~p.",
+    gas:info(?MODULE,"OKEY_NG_TABLE_TRN <~p,~p> Unexpected message(info) received at state <~p>: ~p.",
           [GameId, TableId, StateName, Info]),
     {next_state, StateName, StateData}.
 
 terminate(Reason, StateName, #state{game_id = GameId, table_id = TableId, relay = Relay}) ->
-    ?INFO("OKEY_NG_TABLE_TRN <~p,~p> Shutting down at state: <~p>. Reason: ~p",
+    gas:info(?MODULE,"OKEY_NG_TABLE_TRN <~p,~p> Shutting down at state: <~p>. Reason: ~p",
           [GameId, TableId, StateName, Reason]),
     relay_stop(Relay),
     ok.
@@ -375,7 +375,7 @@ handle_parent_message(show_round_result, StateName,
                       #state{relay = Relay, scoring_state = ScoringState,
                              game_id = GameId, table_id = TableId} = StateData) ->
     {FinishInfo, RoundScore, AchsPoints, TotalScore} = ?SCORING:last_round_result(ScoringState),
-    ?INFO("OKEY_NG_TABLE_TRN <~p,~p> RoundScore: ~p Total score: ~p.", [GameId, TableId, RoundScore, TotalScore]),
+    gas:info(?MODULE,"OKEY_NG_TABLE_TRN <~p,~p> RoundScore: ~p Total score: ~p.", [GameId, TableId, RoundScore, TotalScore]),
     Msg = case FinishInfo of
               {win_reveal, Revealer, WrongRejects, _RevealWithColor, _RevealWithOkey, _RevealWithPairs} ->
                   create_okey_round_ended_reveal(Revealer, true, WrongRejects, RoundScore,
@@ -451,7 +451,7 @@ handle_parent_message(Message, StateName,
 handle_relay_message({player_connected, PlayerId} = Msg, StateName,
                      #state{parent = Parent, game_id = GameId,
                             table_id = TableId, players = Players} = StateData) ->
-    ?INFO("OKEY_NG_TABLE_TRN <~p,~p> Received nofitication from the relay: ~p", [GameId, TableId, Msg]),
+    gas:info(?MODULE,"OKEY_NG_TABLE_TRN <~p,~p> Received nofitication from the relay: ~p", [GameId, TableId, Msg]),
     case get_player(PlayerId, Players) of
         {ok, Player} ->
             NewPlayers = store_player_rec(Player#player{connected = true}, Players),
@@ -477,7 +477,7 @@ handle_relay_message({subscriber_added, PlayerId, SubscrId} = Msg, StateName,
                      #state{relay = Relay, game_id = GameId,
                             table_id = TableId, tournament_table = TTable,
                             players = Players} = StateData) ->
-    ?INFO("OKEY_NG_TABLE_TRN <~p,~p> Received nofitication from the relay: ~p", [GameId, TableId, Msg]),
+    gas:info(?MODULE,"OKEY_NG_TABLE_TRN <~p,~p> Received nofitication from the relay: ~p", [GameId, TableId, Msg]),
     PlayerIdIsValid = case PlayerId of
                           observer -> true;
                           administrator -> true;
@@ -517,7 +517,7 @@ handle_player_action(#player{id = PlayerId, seat_num = SeatNum, user_id = UserId
                      #state{game_id = GameId, table_id = TableId} = StateData) ->
     try api_utils:to_known_record(Action, Args) of
         ExtAction ->
-            ?INFO("OKEY_NG_TABLE_TRN <~p,~p> Player <~p> (~p) submit the game action: ~p.",
+            gas:info(?MODULE,"OKEY_NG_TABLE_TRN <~p,~p> Player <~p> (~p) submit the game action: ~p.",
                   [GameId, TableId, PlayerId, UserId, ExtAction]),
             do_action(SeatNum, ExtAction, From, StateName, StateData)
     catch
@@ -533,7 +533,7 @@ handle_player_action(#player{id = PlayerId, user_id = UserId},
                      StateName,
                      #state{table_id = TableId, game_id = GameId, timeout_timer = TRef,
                             pause_mode = PauseMode, relay = Relay} = StateData) ->
-    ?INFO("OKEY_NG_TABLE_TRN <~p,~p> Received signal from player <~p> : ~p. PauseMode: ~p",
+    gas:info(?MODULE,"OKEY_NG_TABLE_TRN <~p,~p> Received signal from player <~p> : ~p. PauseMode: ~p",
           [GameId, TableId, PlayerId, Signal, PauseMode]),
     case PauseMode of
         disabled ->
@@ -561,7 +561,7 @@ handle_player_action(#player{id = PlayerId, user_id = UserId},
                      #state{table_id = TableId, game_id = GameId, pause_mode = PauseMode,
                             relay = Relay, paused_statename = ResumedStateName,
                             paused_timeout_value = Timeout} = StateData) ->
-    ?INFO("OKEY_NG_TABLE_TRN <~p,~p> Received signal from player <~p> : ~p. PauseMode: ~p",
+    gas:info(?MODULE,"OKEY_NG_TABLE_TRN <~p,~p> Received signal from player <~p> : ~p. PauseMode: ~p",
           [GameId, TableId, PlayerId, Signal, PauseMode]),
     case PauseMode of
         disabled ->
@@ -581,7 +581,7 @@ handle_player_action(#player{id = PlayerId, user_id = UserId},
 handle_player_action(#player{id = PlayerId},
                      {signal, Signal}, _From, StateName,
                      #state{table_id = TableId, game_id = GameId} = StateData) ->
-    ?INFO("OKEY_NG_TABLE_TRN <~p,~p> Received signal from player <~p> : ~p. Ignoring.",
+    gas:info(?MODULE,"OKEY_NG_TABLE_TRN <~p,~p> Received signal from player <~p> : ~p. Ignoring.",
           [GameId, TableId, PlayerId, Signal]),
     {reply, ok, StateName, StateData};
 
@@ -716,7 +716,7 @@ do_timeout_moves(#state{desk_rule_pid = Desk, desk_state = DeskState} = StateDat
 
 do_game_action(SeatNum, GameAction, From, StateName,
                #state{desk_rule_pid = Desk} = StateData) ->
-    ?INFO("OKEY_NG_TABLE_TRN do_game_action SeatNum: ~p  GameAction: ~p", [SeatNum, GameAction]),
+    gas:info(?MODULE,"OKEY_NG_TABLE_TRN do_game_action SeatNum: ~p  GameAction: ~p", [SeatNum, GameAction]),
     case desk_player_action(Desk, SeatNum, GameAction) of
         {ok, Events} ->
             Response = case GameAction of
@@ -799,7 +799,7 @@ finalize_round(#state{desk_state = #desk_state{finish_reason = FinishReason,
                       reveal_confirmation_list = CList,
                       parent = Parent, players = Players,
                       game_id = GameId, table_id = TableId} = StateData) ->
-    ?INFO("OKEY_NG_TABLE_TRN <~p,~p> Finalizing the round. Finish reason: ~p. Finish info: ~p.",
+    gas:info(?MODULE,"OKEY_NG_TABLE_TRN <~p,~p> Finalizing the round. Finish reason: ~p. Finish info: ~p.",
           [GameId, TableId, FinishReason, FinishInfo]),
     FR = case FinishReason of
              tashes_out -> tashes_out;
@@ -810,7 +810,7 @@ finalize_round(#state{desk_state = #desk_state{finish_reason = FinishReason,
                  ConfirmationList = if RevealConfirmation -> CList; true -> [] end,
                  CListUId = [{SeatNum, get_user_id_by_seat_num(SeatNum, Players), Response}
                              || {SeatNum, Response} <- ConfirmationList],
-                 ?INFO("OKEY_NG_TABLE_TRN <~p,~p> Confirmation list: ~p.", [GameId, TableId, CListUId]),
+                 gas:info(?MODULE,"OKEY_NG_TABLE_TRN <~p,~p> Confirmation list: ~p.", [GameId, TableId, CListUId]),
                  {reveal, Revealer, Tashes, Discarded, ConfirmationList};
              gosterge_finish ->
                  Winner = FinishInfo,
@@ -822,11 +822,11 @@ finalize_round(#state{desk_state = #desk_state{finish_reason = FinishReason,
     RoundScorePl = [{get_player_id_by_seat_num(SeatNum, Players), Points} || {SeatNum, Points} <- RoundScore],
     TotalScorePl = [{get_player_id_by_seat_num(SeatNum, Players), Points} || {SeatNum, Points} <- TotalScore],
     if GameOver ->
-           ?INFO("OKEY_NG_TABLE_TRN <~p,~p> Set is over.", [GameId, TableId]),
+           gas:info(?MODULE,"OKEY_NG_TABLE_TRN <~p,~p> Set is over.", [GameId, TableId]),
            parent_send_game_res(Parent, TableId, NewScoringState, RoundScorePl, TotalScorePl),
            {next_state, ?STATE_SET_FINISHED, StateData#state{scoring_state = NewScoringState}};
        true ->
-           ?INFO("OKEY_NG_TABLE_TRN <~p,~p> Round is over.", [GameId, TableId]),
+           gas:info(?MODULE,"OKEY_NG_TABLE_TRN <~p,~p> Round is over.", [GameId, TableId]),
            parent_send_round_res(Parent, TableId, NewScoringState, RoundScorePl, TotalScorePl),
            {next_state, ?STATE_FINISHED, StateData#state{scoring_state = NewScoringState}}
     end.
@@ -869,7 +869,7 @@ handle_desk_events([Event | Events], DeskState, Players, Relay) ->
                 DeskState#desk_state{hands = NewHands, discarded = NewDiskarded, state = state_discard};
             {taked_from_table, SeatNum, Tash} ->
                 [Tash | NewDeck] = Deck,
-                Msg = create_okey_tile_taken_table(SeatNum, length(NewDeck), Players),
+                Msg = create_okey_tile_taken_table(SeatNum, Tash, length(NewDeck), Players),
                 relay_publish_ge(Relay, Msg),
                 {_, Hand} = lists:keyfind(SeatNum, 1, Hands),
                 NewHands = lists:keyreplace(SeatNum, 1, Hands, {SeatNum, [Tash | Hand]}),
@@ -1296,11 +1296,11 @@ create_okey_tile_taken_discarded(SeatNum, Tash, PileHeight, Players) ->
                      pile_height = PileHeight}.
 
 
-create_okey_tile_taken_table(SeatNum, PileHeight, Players) ->
+create_okey_tile_taken_table(SeatNum, Tash, PileHeight, Players) ->
     #player{user_id = UserId} = get_player_by_seat_num(SeatNum, Players),
     #okey_tile_taken{player = UserId,
                      pile = 0, %% From the deck on the table
-                     revealed = null,
+                     revealed = tash_to_ext(Tash),
                      pile_height = PileHeight}.
 
 

+ 29 - 29
apps/server/src/okey/game_okey_scoring.erl

@@ -116,7 +116,7 @@ stats(Srv, Uid) ->
 %% @end
 %%--------------------------------------------------------------------
 init([Params]) ->
-    ?INFO("Scoring Params: ~p", [Params]),
+    gas:info(?MODULE,"Scoring Params: ~p", [Params]),
     Mode = proplists:get_value(game_mode, Params),
     {is_mode, true} = {is_mode, is_mode(Mode)},
     Sets = proplists:get_value(sets, Params),
@@ -180,19 +180,19 @@ handle_call({finish_round, _, _, _, _, _, _} = Msg, From, State = #state{set = [
 handle_call({finish_round, #'OkeyGameResults'{} = Res0, Hands, Gosterge, undefined, undefined, undefined}, _From, State0) ->
     #state{mode = Mode0, stats = Stats0} = State0,
     Mode = game_okey:get_scoring_mode(Mode0, Gosterge),
-    ?INFO("scoring mode: ~p", [Mode]),
+    gas:info(?MODULE,"scoring mode: ~p", [Mode]),
     {State1, Stats1} = refill_chanak(Mode, State0, Stats0),
-    ?INFO("chanak value: ~p", [State1#state.chanak]),
+    gas:info(?MODULE,"chanak value: ~p", [State1#state.chanak]),
     Stats = check_hands_for_8_tashes(Hands, Stats1),
     common_round_finish(Stats, Res0, Mode, State1);
 handle_call({finish_round, #'OkeyGameResults'{} = Res0, Hands, Gosterge, Winners, LastRevealTash, RevealHand}, _From, State) ->
     #state{mode = Mode0, stats = Stats0} = State,
     Mode = game_okey:get_scoring_mode(Mode0, Gosterge),
-    ?INFO("scoring mode: ~p", [Mode]),
+    gas:info(?MODULE,"scoring mode: ~p", [Mode]),
     {State1, Stats1} = refill_chanak(Mode, State, Stats0),
-    ?INFO("chanak value: ~p", [State1#state.chanak]),
+    gas:info(?MODULE,"chanak value: ~p", [State1#state.chanak]),
     Stats = check_hands_for_8_tashes(Hands, Stats1),
-    [ ?INFO("Player ~p ended with ~p", [binary_to_list(Player),Ending]) || {_,Player,Ending}<-Stats],
+    [ gas:info(?MODULE,"Player ~p ended with ~p", [binary_to_list(Player),Ending]) || {_,Player,Ending}<-Stats],
     Okey = game_okey:get_okey(Gosterge),
     Stats2 = case Winners of
                  [Winner] ->
@@ -202,7 +202,7 @@ handle_call({finish_round, #'OkeyGameResults'{} = Res0, Hands, Gosterge, Winners
                                  #okey_stats_entry{uid = Winner#okey_player.player_id, reason = even}),
                      C = if_list(with_color(Gosterge, RevealHand),
                                  #okey_stats_entry{uid = Winner#okey_player.player_id, reason = color}),
-                     ?INFO("A: ~p, B: ~p, C: ~p", [A, B, C]),
+                     gas:info(?MODULE,"A: ~p, B: ~p, C: ~p", [A, B, C]),
                      lists:flatten([A, B, C| Stats]);
                  _ ->
                      Stats
@@ -281,7 +281,7 @@ handle_cast(_Msg, State) ->
 % handle_info(die, State) ->
 %     {stop, normal, State};
 handle_info(Info, State) ->
-    ?INFO("unrecognized info: ~p", [Info]),
+    gas:info(?MODULE,"unrecognized info: ~p", [Info]),
     {stop, {error, unrecognized_info}, State}.
 
 %%--------------------------------------------------------------------
@@ -412,15 +412,15 @@ update_history(Res, State) ->
     case State#state.history of
         [] ->
             Res1 = trim_to_10(Res, State#state.mode),
-            ?INFO("old entry: none", []),
-            ?INFO("new entry: ~p", [Spin(Res1)]),
-            ?INFO("cmb entry: ~p", [Spin(Res1)]),
+            gas:info(?MODULE,"old entry: none", []),
+            gas:info(?MODULE,"new entry: ~p", [Spin(Res1)]),
+            gas:info(?MODULE,"cmb entry: ~p", [Spin(Res1)]),
             {State#state{history = [Res1]}, Res1};
         [H|Rest] ->
             C = combine(Res, H, State#state.mode),
-            ?INFO("old entry: ~p", [Spin(H)]),
-            ?INFO("new entry: ~p", [Spin(Res)]),
-            ?INFO("cmb entry: ~p", [Spin(C)]),
+            gas:info(?MODULE,"old entry: ~p", [Spin(H)]),
+            gas:info(?MODULE,"new entry: ~p", [Spin(Res)]),
+            gas:info(?MODULE,"cmb entry: ~p", [Spin(C)]),
             {State#state{history = [C, H | Rest]}, C}
     end.
 
@@ -467,8 +467,8 @@ get_max_countdown_counter(#state{history = [L|_]} = _State) ->
 check_set_ending(#state{mode = countdown, round_cur = RCur,
                         set_cur = SetCur, set_max = SetMax} = State) ->
     {A, B} = get_max_countdown_counter(State),
-    ?INFO("SetCur: ~p, SetMax: ~p", [SetCur, SetMax]),
-    ?INFO("coundown best score: ~p", [{A, B}]),
+    gas:info(?MODULE,"SetCur: ~p, SetMax: ~p", [SetCur, SetMax]),
+    gas:info(?MODULE,"coundown best score: ~p", [{A, B}]),
     case {A, B} of
         {PlayerId, Points} when Points >= 10 ->
             Acc =
@@ -493,32 +493,32 @@ check_set_ending(#state{mode = countdown, round_cur = RCur,
 check_set_ending(State = #state{round_cur = RCur0, round_max = RMax0,
                                 set_cur = SetCur0, set_max = SetMax0})
   when (RCur0 /= RMax0) ->
-    ?INFO("check_set_ending A, next_round. debug: ~p", [{RCur0, RMax0, SetCur0, SetMax0}]),
+    gas:info(?MODULE,"check_set_ending A, next_round. debug: ~p", [{RCur0, RMax0, SetCur0, SetMax0}]),
     State1 = update_to_next_round_or_set(State),
     {State1, next_round, false};
 check_set_ending(State = #state{set_cur = SetCur0, set_max = SetMax0,
                                 round_cur = RCur0, round_max = RMax0})
   when (RCur0 == RMax0) andalso (SetCur0 < SetMax0)->
-    ?INFO("check_set_ending A, next_set. debug: ~p", [{RCur0, RMax0, SetCur0, SetMax0}]),
+    gas:info(?MODULE,"check_set_ending A, next_set. debug: ~p", [{RCur0, RMax0, SetCur0, SetMax0}]),
     State1 = update_to_next_round_or_set(State),
     {State1, next_set, false};
 check_set_ending(State = #state{set_cur = SetCur, set_max = SetMax,
                                 round_cur = RCur, round_max = RMax}) ->
-    ?INFO("check_set_ending B, done. debug: ~p", [{RCur, RMax, SetCur, SetMax}]),
+    gas:info(?MODULE,"check_set_ending B, done. debug: ~p", [{RCur, RMax, SetCur, SetMax}]),
     State1 = update_to_next_round_or_set(State),
     {State1, done, false}.
 
 update_to_next_round_or_set(State = #state{mode = Mode}) when Mode == standard; Mode == evenodd; Mode == color ->
     NextRound = State#state.round_cur + 1,
     CurrentSet = State#state.set_cur,
-    ?INFO("update_to_next_round_or_set. {set_cur, round_cur}: ~p", [{State#state.set_cur, State#state.round_cur}]),
+    gas:info(?MODULE,"update_to_next_round_or_set. {set_cur, round_cur}: ~p", [{State#state.set_cur, State#state.round_cur}]),
     case NextRound > State#state.round_max of
         true ->
             %% new set
-            ?INFO("next set", []),
+            gas:info(?MODULE,"next set", []),
             State#state{round_cur = 1, set_cur = CurrentSet + 1, stats = [], gosterge_shown = false};
         false ->
-            ?INFO("next round", []),
+            gas:info(?MODULE,"next round", []),
             %% new round
             State#state{round_cur = NextRound, stats = [], gosterge_shown = false}
     end;
@@ -538,7 +538,7 @@ check_hands_for_8_tashes(Hands, Stats) ->
                 end, Stats, Hands).
 
 reset_scoring0(State) ->
-    ?INFO("External reset scoring. set 1, round 1", []),
+    gas:info(?MODULE,"External reset scoring. set 1, round 1", []),
     State#state{round_cur = 1, set_cur = 1, stats = [], gosterge_shown = false, history = []}.
 
 common_round_finish(Stats, Res0, Mode, State1) ->
@@ -608,7 +608,7 @@ update_set_state(State, R = #'OkeyGameResults'{}, CW) ->
     
     Reward = State#state.chanak,
     #'OkeyGameR'{breakdown = BR, score = OrgScore, score_delta = OrgDelta} = CW,
-    ?INFO("chanak points: ~p", [Reward]),
+    gas:info(?MODULE,"chanak points: ~p", [Reward]),
     BR1 = [#'OkeyScoringDetail'{reason = <<"chanak points">>, score = Reward} | BR],
 
     Entries2 = [CW#'OkeyGameR'{breakdown = BR1,
@@ -635,13 +635,13 @@ new_chanak(Mode) ->
 
 analyze_game(Stats, #'OkeyGameResults'{results = PlayerResults0} = Res, Mode) ->
     PlayerEvents = dict:from_list([ {Id, []} || #'OkeyGameR'{player_id = Id} <- PlayerResults0 ]),
-%    ?INFO("PlayerEvents: ~p", [PlayerEvents]),
+%    gas:info(?MODULE,"PlayerEvents: ~p", [PlayerEvents]),
     PlayerEvents1 = analyze_game0(Stats, PlayerEvents, fun describe_achievement/2),
-%    ?INFO("PlayerEvents1: ~p", [PlayerEvents1]),
+%    gas:info(?MODULE,"PlayerEvents1: ~p", [PlayerEvents1]),
     Check = [ check_stats(X) ||  {_Id, X} <- dict:to_list(PlayerEvents1) ],
     case lists:any(fun(Bool) -> Bool end, Check) of
         false ->
-%            ?INFO("PlayerEvents: ~p", [PlayerEvents1]),
+%            gas:info(?MODULE,"PlayerEvents: ~p", [PlayerEvents1]),
             erlang:error(incomplete_stats_detected);
         true -> ok
     end,
@@ -735,7 +735,7 @@ with_even_tashes(Gosterge, Hand0) ->
     Res = lists:all(fun(S) ->
                       game_okey:is_pair(S)
               end, Sets),
-    Res andalso ?INFO("Detected even tashes, gosterge: ~p~nhand ~p", [Gosterge, Hand0]),
+    Res andalso gas:info(?MODULE,"Detected even tashes, gosterge: ~p~nhand ~p", [Gosterge, Hand0]),
     Res.
 
 with_8_tashes(Hand0) ->
@@ -1055,7 +1055,7 @@ reduce_ach_test() ->
 
 insert_at_random_test() ->
     A = put_some_nulls(20, lists:seq(1, 10)),
-    ?INFO("insert_at_random_test: ~p", [A]).
+    gas:info(?MODULE,"insert_at_random_test: ~p", [A]).
 
 
 positions_arrange_test() ->

+ 65 - 65
apps/server/src/okey/test_okey.erl

@@ -208,7 +208,7 @@ start_test_game_t(MultiOwner, CreateMode, RevealMode) ->
 				   init_with_match_me_replaceable(Owner, Host, Port, ReplacementId, 0, RevealMode) 
 			  end),
 
-            ?INFO("replacement players pid: ~p", [Replacement]),
+            gas:info(?MODULE,"replacement players pid: ~p", [Replacement]),
 
             Others = [],
             Clients = Clients0 ++ [Replacement] ++ Others,
@@ -220,14 +220,14 @@ start_test_game_t(MultiOwner, CreateMode, RevealMode) ->
             Humans = [<<"paul">>],%<<"radistao">>, <<"paul">>],
             {ok, GameId, _A} = game_manager:create_table(game_okey, [{sets,2}, {rounds,20},{game_mode,color}], Robots ++ Humans),
 
-	    ?INFO("created table for Okey Game: gameid ~p",[{GameId,_A}]),
+	    gas:info(?MODULE,"created table for Okey Game: gameid ~p",[{GameId,_A}]),
 
             Clients = [ proc_lib:spawn_link(fun() -> 
 				 timer:sleep(crypto:rand_uniform(0, 10)),
                                  init_with_join_game(Owner, Host, Port, GameId, Id, Rematch, RevealMode)
                         end) || Id <- Humans ],
 
-            ?INFO("Human Pids: ~p",[Clients]),
+            gas:info(?MODULE,"Human Pids: ~p",[Clients]),
             
             Orders = [];
 
@@ -349,7 +349,7 @@ init_with_join_game_observe(_Owner, Host, Port, GameId, OwnId, Mode, EJoinResult
     Stats = ?TCM:call_rpc(S1, #get_player_stats{game_type = <<"okey">>, player_id = Id}) ,
     #'PlayerOkeyStats'{} = Stats,
     JR = ?TCM:call_rpc(S1, #join_game{game = GameId}) ,
-    ?INFO("JR: ~p, expected result: ~p", [JR, EJoinResult]),
+    gas:info(?MODULE,"JR: ~p, expected result: ~p", [JR, EJoinResult]),
     true = cmpr(EJoinResult, JR),
     log(finished),
     ok = ?TCM:flush_events(?FLUSH_DELAY),
@@ -383,27 +383,27 @@ init_with_match_me_replaceable(_Owner, Host, Port, OwnId, _Rematch, RevealMode)
     log(connected),
     Stats = ?TCM:call_rpc(S1, #get_player_stats{game_type = <<"okey">>, player_id = Id}),
     #'PlayerOkeyStats'{level = _Level} = Stats,
-    ?INFO("match me replaceable 2", []),
+    gas:info(?MODULE,"match me replaceable 2", []),
     ZZZ = ?TCM:call_rpc(S1, #match_me{game_type = <<"okey">>}),
-    ?INFO("match me replaceable status: ~p", [ZZZ]),
+    gas:info(?MODULE,"match me replaceable status: ~p", [ZZZ]),
     GameId =
         receive
             #'game_matched'{} = Rec ->
-                ?INFO("got game_matched: ~p", [Rec]),
+                gas:info(?MODULE,"got game_matched: ~p", [Rec]),
                 true = Rec#game_matched.is_replacing,
                 log(matched),
                 Rec#game_matched.game
         after ?BT -> erlang:error({server_timeout, self(), ZZZ, "game_matched"})
         end,
     State = #state{conn = S1, gid = GameId, uid = Id},
-    ?INFO("picking up game", []),
+    gas:info(?MODULE,"picking up game", []),
     pickup_game(State).
 
 init_with_match_me_disconnect(Owner, Host, Port, OwnId, Rematch, Mode, false) ->
-    ?INFO("player discon normal", []),
+    gas:info(?MODULE,"player discon normal", []),
     init_with_match_me(Owner, Host, Port, OwnId, Rematch, Mode);
 init_with_match_me_disconnect(_Owner, Host, Port, OwnId, _Rematch, _Mode, true) ->
-    ?INFO("player discon bad", []),
+    gas:info(?MODULE,"player discon bad", []),
     S1 = ?TCM:connect(Host, Port),
     TT = ?TEST_TOKEN,
     #'PlayerInfo'{id = Id} = ?TCM:call_rpc(S1, #session_attach_debug{token = TT, id = OwnId}) ,
@@ -417,24 +417,24 @@ init_with_match_me_disconnect(_Owner, Host, Port, OwnId, _Rematch, _Mode, true)
 
 pickup_game(S0) ->
     Id = S0#state.uid,
-    ?INFO("ID: ~p, waiting for #okey_game_info", [Id]),
+    gas:info(?MODULE,"ID: ~p, waiting for #okey_game_info", [Id]),
     log(game_picked_up),
     GI = receive
              #'game_event'{event = <<"okey_game_info">>, args = Args0} ->
                  A0 = api_utils:to_known_record(okey_game_info, Args0),
-                 ?INFO("A0: ~p", [A0]),
+                 gas:info(?MODULE,"A0: ~p", [A0]),
                  A0
          after ?BT -> erlang:error({server_timeout, "game_rematched"})
          end,
-    ?INFO("ID: ~p, waiting for #okey_game_player_state", [Id]),
+    gas:info(?MODULE,"ID: ~p, waiting for #okey_game_player_state", [Id]),
     GS = receive
              #'game_event'{event = <<"okey_game_player_state">>, args = Args} ->
                  A = api_utils:to_known_record(okey_game_player_state, Args),
-                 ?INFO("A: ~p", [A]),
+                 gas:info(?MODULE,"A: ~p", [A]),
                  A
          after ?BT -> erlang:error({server_timeout, "game_rematched"})
          end,
-    ?INFO("picking up the game", []),
+    gas:info(?MODULE,"picking up the game", []),
     NTI = GS#okey_game_player_state.next_turn_in,
     true = is_integer(NTI) orelse NTI =:= <<"infinity">>,
     SS = #'OkeySetState'{
@@ -452,30 +452,30 @@ pickup_game(S0) ->
              },
     Turn = GS#okey_game_player_state.whos_move,
     GameState = GS#okey_game_player_state.game_state,
-    ?INFO("ID: ~p, picking up the game. Turn: ~p, GameState: ~p", [Id, Turn, GameState]),
+    gas:info(?MODULE,"ID: ~p, picking up the game. Turn: ~p, GameState: ~p", [Id, Turn, GameState]),
     case {Turn, GameState} of
         {_, <<"game_finished">>} ->
-            ?INFO("init bot finished", []),
+            gas:info(?MODULE,"init bot finished", []),
             okey_client_rematch(State),
             play_set(State, 0);
         {_, <<"do_okey_ready">>} ->
-            ?INFO("init bot wait", []),
+            gas:info(?MODULE,"init bot wait", []),
             loop_and_restart(State);
         {Id, <<"do_okey_take">>} ->
-            ?INFO("init bot: move both", []),
+            gas:info(?MODULE,"init bot: move both", []),
             State1 = do_turn(State, 1),
             okey_client_loop(State1);
         {Id, <<"do_okey_discard">>} ->
-            ?INFO("init bot: move discard only", []),
+            gas:info(?MODULE,"init bot: move discard only", []),
             {TryDiscard, _} = draw_random(Hand),
             Hand1 = do_discard(State, Hand, TryDiscard, 1),
             okey_client_loop(State#state{hand = Hand1});
         {_, <<"do_okey_challenge">>} ->
-            ?INFO("init bot: challenge", []),
+            gas:info(?MODULE,"init bot: challenge", []),
             do_challenge(State),
             okey_client_loop(State#state{hand = Hand});
         {_, _} ->
-            ?INFO("init bot: not bot's move", []),
+            gas:info(?MODULE,"init bot: not bot's move", []),
             okey_client_loop(State#state{hand = Hand})
     end.
 
@@ -485,45 +485,45 @@ loop_and_restart(#state{set_state = #'OkeySetState'{round_max = MR, round_cur =
 loop_and_restart(State) ->
     #state{set_state = #'OkeySetState'{round_cur = RC}} = State,
     {Hand0, Gosterge0} = get_hand(State),
-    ?INFO("Human {Hand,Gosterge}: ~p",[{Hand0,Gosterge0}]),
+    gas:info(?MODULE,"Human {Hand,Gosterge}: ~p",[{Hand0,Gosterge0}]),
     LoopRes = okey_client_loop(State#state{hand = Hand0, gosterge = Gosterge0}),
-    ?INFO("Human LoopRes: ~p",[LoopRes]),
+    gas:info(?MODULE,"Human LoopRes: ~p",[LoopRes]),
     case LoopRes of
         <<"done">> ->
-            ?INFO("ID: ~p, next action done", [State#state.uid]),
+            gas:info(?MODULE,"ID: ~p, next action done", [State#state.uid]),
             ok;
         <<"next_set">> ->
             say_ready(State),
-            ?INFO("ID: ~p, next action next_set", [State#state.uid]),
+            gas:info(?MODULE,"ID: ~p, next action next_set", [State#state.uid]),
             ok;
         <<"next_round">> ->
             say_ready(State),
-            ?INFO("ID: ~p, next action next_round", [State#state.uid]),
+            gas:info(?MODULE,"ID: ~p, next action next_round", [State#state.uid]),
             State1 = State#state{set_state = #'OkeySetState'{round_cur = RC + 1}},
             check_ack(State1, game_ended, fun loop_and_restart/1, [State1])
     end.
 
 play_set(State0, Rematch) ->
-%    ?INFO("ID: ~p, sets: start", [State0#state.uid]),
+%    gas:info(?MODULE,"ID: ~p, sets: start", [State0#state.uid]),
     Id = State0#state.uid,
     State = init_okey_tour(State0),
     Rounds = (State#state.set_state)#'OkeySetState'.round_max,
     SetNo = (State#state.set_state)#'OkeySetState'.set_cur,
     Sets = (State#state.set_state)#'OkeySetState'.set_max,
-    ?INFO("ID: ~p Start playing ~p/~p set of ~p rounds",[State0#state.uid,SetNo,Sets,Rounds]),
+    gas:info(?MODULE,"ID: ~p Start playing ~p/~p set of ~p rounds",[State0#state.uid,SetNo,Sets,Rounds]),
     loop_and_restart(State),
-    ?INFO("ID: ~p Finish playing ~p/~p set of ~p rounds",[State0#state.uid,SetNo,Sets,Rounds]),
+    gas:info(?MODULE,"ID: ~p Finish playing ~p/~p set of ~p rounds",[State0#state.uid,SetNo,Sets,Rounds]),
     case {SetNo, Rematch} of
         {X, 0} when X == Sets ->
-            ?INFO("last set, no rematch", []),
+            gas:info(?MODULE,"last set, no rematch", []),
             get_series_ended(Id),
             ok;
         {X, _} when X == Sets ->
-            ?INFO("ID: ~p, last set, do rematch", [State0#state.uid]),
+            gas:info(?MODULE,"ID: ~p, last set, do rematch", [State0#state.uid]),
             okey_client_rematch(State),
             play_set(State, Rematch-1);
         _ ->
-            ?INFO("ID: ~p,  play next set", [State0#state.uid]),
+            gas:info(?MODULE,"ID: ~p,  play next set", [State0#state.uid]),
             play_set(State, Rematch)
     end.
 
@@ -531,7 +531,7 @@ init_okey_tour(State) ->
     GameId = State#state.gid,
     receive
         #'game_event'{event = <<"okey_game_info">>, args = Args, game = GI} ->
-%           ?INFO("CLIENT TOUR STARTED okey_game_info:~n ~p", [Args]),
+%           gas:info(?MODULE,"CLIENT TOUR STARTED okey_game_info:~n ~p", [Args]),
             GT = proplists:get_value(game_type, Args),
             Rounds = proplists:get_value(rounds, Args),
             Sets = proplists:get_value(sets, Args),
@@ -551,15 +551,15 @@ init_okey_tour(State) ->
             log(game_info),
             State#state{set_state = SS, mode = GT}
     after ?BT ->
-            ?INFO("ERROR: ~p", [{server_timeout, "game_event:okey_game_info"}]),
+            gas:info(?MODULE,"ERROR: ~p", [{server_timeout, "game_event:okey_game_info"}]),
             erlang:error({server_timeout, "game_event:okey_game_info"})
     end.
 
 get_series_ended(Id)->
-    ?INFO("ID: ~p; waiting for okey_series_ended", [Id]),
+    gas:info(?MODULE,"ID: ~p; waiting for okey_series_ended", [Id]),
     receive
         #game_event{event = <<"okey_series_ended">>} ->
-            ?INFO("ID: ~p CLIENT SERIES ENDED", [Id]),
+            gas:info(?MODULE,"ID: ~p CLIENT SERIES ENDED", [Id]),
             log(tour_ended)
     after ?BT -> erlang:error({server_timeout, "okey_series_ended"})
     end.
@@ -568,11 +568,11 @@ okey_client_rematch(State) ->
     S1 = State#state.conn, GameId = State#state.gid, Id = State#state.uid,
     get_series_ended(Id),
     RematchR = ?TCM:call_rpc(S1, #rematch{game = GameId}) ,
-    ?INFO("ID: ~p; rematch result: ~p", [Id, RematchR]),
+    gas:info(?MODULE,"ID: ~p; rematch result: ~p", [Id, RematchR]),
     <<"ok">> = RematchR,
     receive
         #game_rematched{game = GameId} ->
-            ?INFO("#game_rematched{game = GameId}", []),
+            gas:info(?MODULE,"#game_rematched{game = GameId}", []),
             log(game_rematched)
     after ?BT -> erlang:error({server_timeout, "game_rematched"})
     end.
@@ -595,10 +595,10 @@ get_hand(State) ->
 
             ((MH == undefined) orelse (G == undefined)) andalso erlang:error(cant_get_params_of_hand),
 
-            ?INFO("Human Round/Set: ~p/~p", [CR,CS]),
+            gas:info(?MODULE,"Human Round/Set: ~p/~p", [CR,CS]),
             HasGosterge = lists:member(G, MH),
             HasGostergeServer = ?TCM:call_rpc(S1, #game_action{game = GameId, action = okey_has_gosterge, args = []}),
-            ?INFO("HasGostergeServer: ~p",[HasGostergeServer]),
+            gas:info(?MODULE,"HasGostergeServer: ~p",[HasGostergeServer]),
             HasGosterge = HasGostergeServer,
             check_ack(State, got_hand, fun() -> ok end, []),
             {MH, G}
@@ -618,7 +618,7 @@ check_ack(State = #state{acker_fun = F}, Event, ContinueFun, Args) ->
             apply(What, [State] ++ With),
             apply(ContinueFun, Args);
         stop ->
-            ?INFO("ID: ~p, Pid: ~p, check_ack. STOPPING THE BOT!!!", [State#state.uid, self()]),
+            gas:info(?MODULE,"ID: ~p, Pid: ~p, check_ack. STOPPING THE BOT!!!", [State#state.uid, self()]),
             erlang:error({terminate, acker_stop})
     end.
 
@@ -628,13 +628,13 @@ validate_hand(S, GameId, Hand) ->
                          action = okey_debug,
                          args = []})  of
         {error, Reason} ->
-            ?INFO("dying in fire. Reason: ~p", [Reason]),
+            gas:info(?MODULE,"dying in fire. Reason: ~p", [Reason]),
             erlang:error(die_in_fire);
         ServerHand ->
             Res = game_okey:is_same_hand(ServerHand, Hand),
             case Res of
                 false ->
-                    ?INFO("validation failed: ~p =/= ~p", [Hand, ServerHand]);
+                    gas:info(?MODULE,"validation failed: ~p =/= ~p", [Hand, ServerHand]);
                 _ ->
                     ok
             end,
@@ -680,7 +680,7 @@ okey_client_loop(State) ->
             GS = proplists:get_value(good_shot, Args),
             Reason = proplists:get_value(reason, Args),
             NextAction = proplists:get_value(next_action, Args),
-            ?INFO("ID: ~p game ended, good_shot: ~p, reason: ~p", [Id, GS, Reason]),
+            gas:info(?MODULE,"ID: ~p game ended, good_shot: ~p, reason: ~p", [Id, GS, Reason]),
             NextAction;
         #player_left{} ->
             okey_client_loop(State);
@@ -698,7 +698,7 @@ okey_client_loop(State) ->
             NextAction = proplists:get_value(next_action, Args),
             NextAction;
         _Msg ->
-            ?INFO("the msg: ~p", [_Msg]),
+            gas:info(?MODULE,"the msg: ~p", [_Msg]),
             erlang:error({bot_received_unrecognized_message, _Msg})
     after ?BT ->
             log(server_timeouted),
@@ -727,7 +727,7 @@ do_challenge(State) ->
                          game = GameId,
                          action = okey_challenge,
                          args = [ {challenge, random_bool(0.2)} ]}),
-    ?INFO("ID: ~p challenge result: ~p", [State#state.uid, ZZZ]),
+    gas:info(?MODULE,"ID: ~p challenge result: ~p", [State#state.uid, ZZZ]),
     ok.
 
 do_take(State, Timeout) ->
@@ -737,7 +737,7 @@ do_take(State, Timeout) ->
     {is_list, true} = {is_list, is_list(Hand)},
     receive
         #'game_event'{event = <<"okey_turn_timeout">>, args = Args} ->
-                                                % ?INFO("ID: ~p I timeouted on take", [Id]),
+                                                % gas:info(?MODULE,"ID: ~p I timeouted on take", [Id]),
             TileT = proplists:get_value(<<"tile_taken">>, Args),
             TileD = proplists:get_value(<<"tile_discarded">>, Args),
             Hand1 = lists:delete(TileD, Hand),
@@ -750,22 +750,22 @@ do_take(State, Timeout) ->
                                args = [ {pile, Pile} ]}) of
                 #'OkeyPiece'{} = Tosh ->
                     MyHand = [Tosh | Hand],
-                                                % ?INFO("ID: ~p Take tosh in ~p pile! Get: ~p", [Id, Pile, Tosh]),
+                                                % gas:info(?MODULE,"ID: ~p Take tosh in ~p pile! Get: ~p", [Id, Pile, Tosh]),
                     {false, MyHand};
                 {error, <<"cant_take_do_discard">>} ->
-                                                % ?INFO("ID: ~p Has 15 items in hand. 15=~p", [Id, length(Hand)]),
+                                                % gas:info(?MODULE,"ID: ~p Has 15 items in hand. 15=~p", [Id, length(Hand)]),
                     {false, Hand};
                 {error, <<"game_has_already_ended">>} = Err ->
                     case State#state.mode of
                         <<"countdown">> ->
                             {false, Hand};
                         _ ->
-                            ?INFO("ID: ~p; mode:~p; failed take with msg ~p",
+                            gas:info(?MODULE,"ID: ~p; mode:~p; failed take with msg ~p",
                                 [State#state.uid, State#state.mode, Err]),
                             erlang:error(failed_take)
                     end;
                 Err ->
-                    ?INFO("ID: ~p failed take with msg ~p", [State#state.uid, Err]),
+                    gas:info(?MODULE,"ID: ~p failed take with msg ~p", [State#state.uid, Err]),
                     erlang:error(failed_take)
             end
     end.
@@ -834,14 +834,14 @@ is_revealing(_PileHeight, _, empty_pile) ->
 wait_for(_C) ->
     receive
         {_, game_ended} ->
-            ?INFO("client: game ended");
+            gas:info(?MODULE,"client: game ended");
         {'EXIT', _, normal} = M ->
-            ?INFO("client: normal ending: ~p", [M]);
+            gas:info(?MODULE,"client: normal ending: ~p", [M]);
         {'EXIT', _C, Reason} = M ->
-            ?INFO("client: FAILURE message: ~p", [{M,_C,Reason}]),
+            gas:info(?MODULE,"client: FAILURE message: ~p", [{M,_C,Reason}]),
             erlang:error(Reason);
         M ->
-            ?INFO("client: unrecognized result: ~p", [M]),
+            gas:info(?MODULE,"client: unrecognized result: ~p", [M]),
             erlang:error(M)
     end.
 
@@ -877,17 +877,17 @@ standard_acker(Owner) ->
     Ref = make_ref(),
     fun(Event) ->
             E = {event, Ref, Self, Event},
-            ?INFO("standard acker. ~p ! ~p", [Owner, E]),
+            gas:info(?MODULE,"standard acker. ~p ! ~p", [Owner, E]),
             Owner ! E,
             receive
                 {ARef, Res} when Ref == ARef ->
-                    ?INFO("standard acker got '~p' answer on question ~p", [Res,{Owner, E}]),
+                    gas:info(?MODULE,"standard acker got '~p' answer on question ~p", [Res,{Owner, E}]),
                     Res
             end
     end.
 
 conductor(Orders, Clients) ->
-    ?INFO("conductor init", []),
+    gas:info(?MODULE,"conductor init", []),
     Pairs = lists:zip(lists:seq(1, length(Clients)), Clients),
     Orders2 = lists:map(fun(O) ->
                                 {_, P} = lists:keyfind(O#bo.pid, 1, Pairs),
@@ -895,7 +895,7 @@ conductor(Orders, Clients) ->
                         end, Orders),
     conductor(Orders2, Clients, []).
 conductor(_Orders, [], _Events) ->
-    ?INFO("conductor stop", []),
+    gas:info(?MODULE,"conductor stop", []),
     ok;
 conductor(Orders, Clients, Events) ->
     receive
@@ -910,19 +910,19 @@ conductor(Orders, Clients, Events) ->
             end,
             conductor(Orders, Clients, E2);
         {C, game_ended} ->
-            ?INFO("conductor: game ended", []),
+            gas:info(?MODULE,"conductor: game ended", []),
             conductor(Orders, lists:delete(C, Clients), Events);
         {'EXIT', C, normal} = M ->
-            ?INFO("conductor: normal ending: ~p", [M]),
+            gas:info(?MODULE,"conductor: normal ending: ~p", [M]),
             conductor(Orders, lists:delete(C, Clients), Events);
         {'EXIT', C, {terminate, acker_stop}} = M ->
-            ?INFO("conductor: removing client ~p because of ~p", [C, M]),
+            gas:info(?MODULE,"conductor: removing client ~p because of ~p", [C, M]),
             conductor(Orders, lists:delete(C, Clients), Events);
         {'EXIT', _C, Reason} = M ->
-            ?INFO("conductor: FAILURE message: ~p", [{M,_C,Reason}]),
+            gas:info(?MODULE,"conductor: FAILURE message: ~p", [{M,_C,Reason}]),
             erlang:error(Reason);
         M ->
-            ?INFO("conductor: unrecognized msg from client: ~p", [M]),
+            gas:info(?MODULE,"conductor: unrecognized msg from client: ~p", [M]),
             erlang:error(M)
     end.
 

+ 2 - 2
apps/server/src/okey_sup.erl

@@ -12,14 +12,14 @@ start() -> supervisor:start({local, ?SERVER}, ?MODULE, []).
 start_link() -> supervisor:start_link({local, ?SERVER}, ?MODULE, []).
 stop() -> exit(?SERVER, shutdown).
 start_game(Mod,Par,GameId) -> 
-    ?INFO("OKEY SUP START CHILD"),
+    gas:info(?MODULE,"OKEY SUP START CHILD"),
     Restart = transient,
     Shutdown = 200,
     ChildSpec = {GameId, {Mod, start_link, Par}, Restart, Shutdown, worker, [Mod]},
     supervisor:start_child(?MODULE,ChildSpec).
 
 init([]) ->
-    ?INFO("OKEY SUP STARTED"),
+    gas:info(?MODULE,"OKEY SUP STARTED"),
     RestartStrategy = one_for_one,
     MaxRestarts = 1,
     MaxSecondsBetweenRestarts = 600,

+ 14 - 14
apps/server/src/relay_ng.erl

@@ -136,11 +136,11 @@ handle_call(_Request, _From, State) ->
 
 %% --------------------------------------------------------------------
 handle_cast({client_message, Msg}, State) ->
-    ?INFO("RELAY_NG Received client message: ~p", [Msg]),
+    gas:info(?MODULE,"RELAY_NG Received client message: ~p", [Msg]),
     handle_client_message(Msg, State);
 
 handle_cast({table_message, Msg}, State) ->
-    ?INFO("RELAY_NG Received table message: ~p", [Msg]),
+    gas:info(?MODULE,"RELAY_NG Received table message: ~p", [Msg]),
     handle_table_message(Msg, State);
 
 handle_cast(_Msg, State) ->
@@ -150,7 +150,7 @@ handle_cast(_Msg, State) ->
 handle_info({'DOWN', TableMonRef, process, _Pid, _Info},
             #state{subscribers = Subscribers,
                    table_mon_ref = TableMonRef} = State) ->
-    ?INFO("RELAY_NG All The parent table is down. "
+    gas:info(?MODULE,"RELAY_NG All The parent table is down. "
           "Disconnecting all subscribers and sutting down.", []),
     [begin
          erlang:demonitor(MonRef, [flush]),
@@ -170,7 +170,7 @@ handle_info({'DOWN', MonRef, process, _Pid, _Info},
             NewSubscribers = del_subscriber(SubscrId, Subscribers),
             case find_subscribers_by_player_id(PlayerId, NewSubscribers) of
                 [] ->
-                    ?INFO("RELAY_NG All sessions of player <~p> (~p) are closed. "
+                    gas:info(?MODULE,"RELAY_NG All sessions of player <~p> (~p) are closed. "
                           "Sending the notification to the table.", [PlayerId, UserId]),
                     NewPlayers = update_player_status(PlayerId, offline, Players),
                     TableMod:relay_message(TablePid, {player_disconnected, PlayerId}),
@@ -213,27 +213,27 @@ handle_client_request({subscribe, Pid, UserId, observer}, _From,
 handle_client_request({subscribe, Pid, UserId, PlayerId}, _From,
                       #state{players = Players, subscribers = Subscribers,
                              table = {TableMod, TablePid}} = State) ->
-    ?INFO("RELAY_NG Subscription request from user ~p, PlayerId: <~p>", [UserId, PlayerId]),
+    gas:info(?MODULE,"RELAY_NG Subscription request from user ~p, PlayerId: <~p>", [UserId, PlayerId]),
     case find_player(PlayerId, Players) of
         {ok, #player{user_id = UserId, status = Status} = P} ->  %% The user id is matched
-            ?INFO("RELAY_NG User ~p is registered as player <~p>", [UserId, PlayerId]),
-            ?INFO("RELAY_NG User ~p player info: ~p", [UserId, P]),
+            gas:info(?MODULE,"RELAY_NG User ~p is registered as player <~p>", [UserId, PlayerId]),
+            gas:info(?MODULE,"RELAY_NG User ~p player info: ~p", [UserId, P]),
             MonRef = erlang:monitor(process, Pid),
             SubscrId = erlang:make_ref(),
             NewSubscribers = store_subscriber(SubscrId, Pid, UserId, PlayerId, MonRef,
                                               _BroadcastAllowed = false, Subscribers),
             NewPlayers = if Status == offline ->
-                                ?INFO("RELAY_NG Notifying the table about user ~p (<~p>).", [PlayerId, UserId]),
+                                gas:info(?MODULE,"RELAY_NG Notifying the table about user ~p (<~p>).", [PlayerId, UserId]),
                                 TableMod:relay_message(TablePid, {player_connected, PlayerId}),
                                 update_player_status(PlayerId, online, Players);
                             true ->
-                                ?INFO("RELAY_NG User ~p (<~p>) is already subscribed.", [PlayerId, UserId]),
+                                gas:info(?MODULE,"RELAY_NG User ~p (<~p>) is already subscribed.", [PlayerId, UserId]),
                                 Players
                          end,
             TableMod:relay_message(TablePid, {subscriber_added, PlayerId, SubscrId}),
             {reply, {ok, SubscrId}, State#state{players = NewPlayers, subscribers = NewSubscribers}};
         {ok, #player{}=P} ->
-            ?INFO("RELAY_NG Subscription for user ~p rejected. There is another owner of the "
+            gas:info(?MODULE,"RELAY_NG Subscription for user ~p rejected. There is another owner of the "
                   "PlayerId <~p>: ~p", [UserId, PlayerId, P]),
             {reply, {error, not_player_id_owner}, State};
         error ->
@@ -309,7 +309,7 @@ handle_client_message(_Msg, State) ->
 %%===================================================================
 
 handle_table_message({publish, Msg}, #state{subscribers = Subscribers} = State) ->
-    ?INFO("RELAY_NG The table publish message: ~p", [Msg]),
+    gas:info(?MODULE,"RELAY_NG The table publish message: ~p", [Msg]),
     Receipients = subscribers_to_list(Subscribers),
     [Pid ! {relay_event, SubscrId, Msg} ||
      #subscriber{id = SubscrId, pid = Pid, broadcast_allowed = true} <- Receipients],
@@ -317,13 +317,13 @@ handle_table_message({publish, Msg}, #state{subscribers = Subscribers} = State)
 
 handle_table_message({to_client, PlayerId, Msg}, #state{subscribers = Subscribers} = State) ->
     Recepients = find_subscribers_by_player_id(PlayerId, Subscribers),
-    ?INFO("RELAY_NG Send table message to player's (~p) sessions: ~p. Message: ~p",
+    gas:info(?MODULE,"RELAY_NG Send table message to player's (~p) sessions: ~p. Message: ~p",
           [PlayerId, Recepients, Msg]),
     [Pid ! {relay_event, SubscrId, Msg} || #subscriber{id = SubscrId, pid = Pid} <- Recepients],
     {noreply, State};
 
 handle_table_message({to_subscriber, SubscrId, Msg}, #state{subscribers = Subscribers} = State) ->
-    ?INFO("RELAY_NG Send table message to subscriber: ~p. Message: ~p", [SubscrId, Msg]),
+    gas:info(?MODULE,"RELAY_NG Send table message to subscriber: ~p. Message: ~p", [SubscrId, Msg]),
     case get_subscriber(SubscrId, Subscribers) of
         {ok, #subscriber{pid = Pid}} -> Pid ! {relay_event, SubscrId, Msg};
         _ -> do_nothing
@@ -332,7 +332,7 @@ handle_table_message({to_subscriber, SubscrId, Msg}, #state{subscribers = Subscr
 
 handle_table_message({allow_broadcast_for_player, PlayerId},
                      #state{subscribers = Subscribers} = State) ->
-    ?INFO("RELAY_NG Received directive to allow receiving published messages for player <~p>",
+    gas:info(?MODULE,"RELAY_NG Received directive to allow receiving published messages for player <~p>",
           [PlayerId]),
     PlSubscribers = find_subscribers_by_player_id(PlayerId, Subscribers),
     F = fun(Subscriber, Acc) ->

+ 63 - 63
apps/server/src/tavla/game_tavla_bot.erl

@@ -52,7 +52,7 @@ init([Owner, PlayerInfo, GameId]) ->
     {ok, SPid} = game_session:start_link(self()),
     game_session:bot_session_attach(SPid, PlayerInfo),
     UId = PlayerInfo#'PlayerInfo'.id,
-    ?INFO("BOTMODULE ~p started with game_session pid ~p", [UId,SPid]),
+    gas:info(?MODULE,"BOTMODULE ~p started with game_session pid ~p", [UId,SPid]),
     {ok, #state{user = PlayerInfo, uid = UId, owner = Owner, gid = GameId, session = SPid}}.
 
 
@@ -92,24 +92,24 @@ handle_call(get_session, _From, State) ->
 
 handle_call(Request, _From, State) ->
     Reply = ok,
-    ?INFO("unknown call: ~p", [Request]),
+    gas:info(?MODULE,"unknown call: ~p", [Request]),
     {reply, Reply, State}.
 
 handle_cast(join_game, State) ->
     Mon = erlang:monitor(process, State#state.owner),
     UId = State#state.uid,
     GId = State#state.gid,
-    ?INFO("Init State User ~p",[State#state.user]),
+    gas:info(?MODULE,"Init State User ~p",[State#state.user]),
     BPid = proc_lib:spawn_link(game_tavla_bot, robot_init, [#state{gid = GId, uid = UId, conn = self(), table_id = State#state.table_id, user = State#state.user}]),
     BPid ! join_game,
     {noreply, State#state{bot = BPid, owner_mon = Mon}};
 
 handle_cast(Msg, State) ->
-    ?INFO("unknown cast: ~p", [Msg]),
+    gas:info(?MODULE,"unknown cast: ~p", [Msg]),
     {noreply, State}.
 
 handle_info({'DOWN', Ref, process, _, Reason}, State = #state{owner_mon = OMon}) when OMon == Ref ->
-    ?INFO("relay goes down with reason ~p so does bot", [Reason]),
+    gas:info(?MODULE,"relay goes down with reason ~p so does bot", [Reason]),
     {stop, Reason, State};
 handle_info({server,M}, State) ->
     BPid = State#state.bot,
@@ -124,7 +124,7 @@ code_change(_OldVsn, State, _Extra) -> {ok, State}.
 % loops
 
 robot_init(State) ->
-    ?INFO("Robot Init User Info ~p",[State#state.user]),
+    gas:info(?MODULE,"Robot Init User Info ~p",[State#state.user]),
     robot_init_loop(State).
 
 robot_init_loop(State) -> % receiving messages from relay
@@ -135,7 +135,7 @@ robot_init_loop(State) -> % receiving messages from relay
         join_game ->
             case call_rpc(S, #join_game{game = GameId}) of
                 #'TableInfo'{game = _Atom} -> tavla_client_loop(State);
-                _Err -> ?INFO("ID: ~p failed take with msg ~p", [Id, _Err]),
+                _Err -> gas:info(?MODULE,"ID: ~p failed take with msg ~p", [Id, _Err]),
                         erlang:error(robot_cant_join_game)
             end
     end.
@@ -151,57 +151,57 @@ tavla_client_loop(State) -> % incapsulate tavla protocol
         #game_event{event = <<"tavla_next_turn">>, args = Params} = Msg ->
             TableId = proplists:get_value(table_id, Params, 0),
             case TableId == State#state.table_id of true ->
-            ?INFO("TAVLABOT ~p : Received message: ~p", [Id, Msg]),
+            gas:info(?MODULE,"TAVLABOT ~p : Received message: ~p", [Id, Msg]),
             case check_can_roll(GameMode) of
                 true ->
                     case fix_color(proplists:get_value(color, Params)) of
                         MyColor ->
-                            ?INFO("TAVLABOT ~p Doing roll", [Id]),
+                            gas:info(?MODULE,"TAVLABOT ~p Doing roll", [Id]),
                             roll_action(State,TableId),
                             tavla_client_loop(State);
                         _  -> tavla_client_loop(State)
                     end;
                 false ->
-                    ?INFO("TAVLABOT ~p Ignoring tavla_next_turn (paired mode). Server rolls automaticly.", [Id]),
+                    gas:info(?MODULE,"TAVLABOT ~p Ignoring tavla_next_turn (paired mode). Server rolls automaticly.", [Id]),
                     tavla_client_loop(State)
             end;
             _ -> tavla_client_loop(State) end;
         #game_event{event = <<"tavla_moves">>, args = Params} = Msg ->
             TableId = proplists:get_value(table_id, Params, 0),
             case TableId == State#state.table_id of true ->
-            ?INFO("TAVLABOT ~p : Received message: ~p", [Id, Msg]),
+            gas:info(?MODULE,"TAVLABOT ~p : Received message: ~p", [Id, Msg]),
             PlayerColor = fix_color(proplists:get_value(color, Params)),
             From = proplists:get_value(from, Params),
             To = proplists:get_value(to, Params),
-%%            ?INFO("board before moves: ~p", [State#state.board]),
+%%            gas:info(?MODULE,"board before moves: ~p", [State#state.board]),
             Board = reverse_board(State#state.board, PlayerColor),
             FromR=rel(From,PlayerColor), ToR=rel(To,PlayerColor),
             NewBoard = reverse_board(follow_board(Board,FromR,ToR,PlayerColor), PlayerColor),
-%%            ?INFO("board after moves: ~p", [NewBoard]),
+%%            gas:info(?MODULE,"board after moves: ~p", [NewBoard]),
             tavla_client_loop(State#state{board = NewBoard,moves = State#state.moves + 1});
 
             _ -> tavla_client_loop(State) end;
         #game_event{event = <<"tavla_turn_timeout">>, args = Params} = Msg ->
             TableId = proplists:get_value(table_id, Params, 0),
             case TableId == State#state.table_id of true ->
-            ?INFO("TAVLABOT ~p : Received message: ~p", [Id, Msg]),
+            gas:info(?MODULE,"TAVLABOT ~p : Received message: ~p", [Id, Msg]),
             PlayerColor = fix_color(proplists:get_value(color, Params)),
             Moves = ext_to_moves(proplists:get_value(moves, Params)),
-%%            ?INFO("board before moves: ~p", [State#state.board]),
+%%            gas:info(?MODULE,"board before moves: ~p", [State#state.board]),
             Board = reverse_board(State#state.board, PlayerColor),
             F = fun({From, To}, B) ->
                         FromR = rel(From, PlayerColor), ToR = rel(To, PlayerColor),
                         follow_board(B, FromR, ToR, PlayerColor)
                 end,
             NewBoard = reverse_board(lists:foldl(F, Board, Moves), PlayerColor),
-%%            ?INFO("board after moves: ~p", [NewBoard]),
+%%            gas:info(?MODULE,"board after moves: ~p", [NewBoard]),
             tavla_client_loop(State#state{board = NewBoard, moves = State#state.moves + length(Moves)});
             _ -> tavla_client_loop(State) end;
 %%         #game_event{event = <<"tavla_vido_request">>, args = Params} ->
 %%             TableId = proplists:get_value(table_id, Params, 0),
 %%             case TableId == State#state.table_id of true ->
 %% 
-%% %            ?INFO("tavla moves: ~p",[Params]),
+%% %            gas:info(?MODULE,"tavla moves: ~p",[Params]),
 %%             To = proplists:get_value(from, Params),
 %%             vido(State,To,TableId),
 %%             tavla_client_loop(State);
@@ -210,9 +210,9 @@ tavla_client_loop(State) -> % incapsulate tavla protocol
         #game_event{event = <<"tavla_surrender_request">>, args = Params} = Msg->
             TableId = proplists:get_value(table_id, Params, 0),
             case TableId == State#state.table_id of true ->
-            ?INFO("TAVLABOT ~p : Received message: ~p", [Id, Msg]),
+            gas:info(?MODULE,"TAVLABOT ~p : Received message: ~p", [Id, Msg]),
 
-%            ?INFO("tavla moves: ~p",[Params]),
+%            gas:info(?MODULE,"tavla moves: ~p",[Params]),
             To = proplists:get_value(from, Params),
             surrender(State,To,TableId),
             tavla_client_loop(State);
@@ -229,7 +229,7 @@ tavla_client_loop(State) -> % incapsulate tavla protocol
         #game_event{event = <<"tavla_game_player_state">>, args = Params} = Msg->
             TableId = proplists:get_value(table_id, Params, 0),
             case TableId == State#state.table_id of true ->
-            ?INFO("TAVLABOT ~p : Received message: ~p", [Id, Msg]),
+            gas:info(?MODULE,"TAVLABOT ~p : Received message: ~p", [Id, Msg]),
             PlayersColors = proplists:get_value(players_colors, Params),
             WhosMove = proplists:get_value(whos_move, Params),
             BoardRaw = proplists:get_value(board, Params),
@@ -244,13 +244,13 @@ tavla_client_loop(State) -> % incapsulate tavla protocol
 
             FoundMyself = lists:keyfind(Id, #tavla_color_info.name, PlayersColors),
             PlayerColor = fix_color(FoundMyself#tavla_color_info.color),
-            ?INFO("TAVLABOT ~p BoardRaw: ~p", [Id, BoardRaw]),
+            gas:info(?MODULE,"TAVLABOT ~p BoardRaw: ~p", [Id, BoardRaw]),
             Board = if BoardRaw == null -> null;
                        true -> ext_to_board(BoardRaw)
                     end,
             State1 = State#state{board = Board, moves = 0, player_color=PlayerColor},
 
-            ?INFO("TAVLABOT ~p player color: ~p",[Id, PlayerColor]),
+            gas:info(?MODULE,"TAVLABOT ~p player color: ~p",[Id, PlayerColor]),
             MyMove = lists:member(fix_color(PlayerColor), WhosMove),
             case {MyMove, GameState} of
                 {true, <<"first_move_competition">>} ->
@@ -273,14 +273,14 @@ tavla_client_loop(State) -> % incapsulate tavla protocol
         #game_event{event = <<"tavla_game_started">>, args = Params} = Msg->
             TableId = proplists:get_value(table_id, Params, 0),
             case TableId == State#state.table_id of true ->
-            ?INFO("TAVLABOT ~p : Received message: ~p", [Id, Msg]),
+            gas:info(?MODULE,"TAVLABOT ~p : Received message: ~p", [Id, Msg]),
             Players = proplists:get_value(players, Params),
             BoardRaw = proplists:get_value(board, Params),
             Competition = proplists:get_value(do_first_move_competition_roll, Params),
             FoundMyself = lists:keyfind(Id, #tavla_color_info.name, Players),
             PlayerColor = fix_color(FoundMyself#tavla_color_info.color),
-            ?INFO("TAVLABOT ~p game_started, color: ~p",[Id, PlayerColor]),
-            ?INFO("TAVLABOT ~p game_started, BoardRaw: ~p",[Id, BoardRaw]),
+            gas:info(?MODULE,"TAVLABOT ~p game_started, color: ~p",[Id, PlayerColor]),
+            gas:info(?MODULE,"TAVLABOT ~p game_started, BoardRaw: ~p",[Id, BoardRaw]),
             Board = if BoardRaw == null -> null;
                        true -> ext_to_board(BoardRaw)
                     end,
@@ -290,46 +290,46 @@ tavla_client_loop(State) -> % incapsulate tavla protocol
         #game_event{event = <<"tavla_won_first_move">>, args = Params} = Msg ->
             TableId = proplists:get_value(table_id, Params, 0),
             case TableId == State#state.table_id of true ->
-            ?INFO("TAVLABOT ~p : Received message: ~p", [Id, Msg]),
+            gas:info(?MODULE,"TAVLABOT ~p : Received message: ~p", [Id, Msg]),
             State2 = case fix_color(proplists:get_value(color, Params)) of
                 MyColor ->
-                    ?INFO("TAVLABOT ~p : I won the first move order.", [Id]),
+                    gas:info(?MODULE,"TAVLABOT ~p : I won the first move order.", [Id]),
                     case proplists:get_value(reroll, Params) of
                         false ->
                             Dice = proplists:get_value(dice, Params),
-                            ?INFO("TAVLABOT ~p Reroll is not needed. Doing the first move with dice:~p",[Id, Dice]),
+                            gas:info(?MODULE,"TAVLABOT ~p Reroll is not needed. Doing the first move with dice:~p",[Id, Dice]),
                             do_move(State,Dice,TableId,MyColor), State#state{moves = State#state.moves + 1};
                         true ->
-                            ?INFO("TAVLABOT ~p Reroll needed. So doing it.",[Id]),
+                            gas:info(?MODULE,"TAVLABOT ~p Reroll needed. So doing it.",[Id]),
                             roll_action(State, TableId)
                     end;
-                _  -> ?INFO("TAVLABOT ~p tavla_won_first_move: Ignore rolls (another color)",[Id]), State
+                _  -> gas:info(?MODULE,"TAVLABOT ~p tavla_won_first_move: Ignore rolls (another color)",[Id]), State
             end,
             tavla_client_loop(State2);
             _ -> tavla_client_loop(State) end;
         #game_event{event = <<"tavla_rolls">>, args = Params} = Msg->
             TableId = proplists:get_value(table_id, Params, 0),
             case TableId == State#state.table_id of true ->
-            ?INFO("TAVLABOT ~p : Received message: ~p", [Id, Msg]),
+            gas:info(?MODULE,"TAVLABOT ~p : Received message: ~p", [Id, Msg]),
             State2 = case fix_color(proplists:get_value(color, Params)) of
                 MyColor ->
                       Dice = proplists:get_value(dices, Params),
                       case Dice of
                         [_A,_B] ->
-                            ?INFO("TAVLABOT ~p Doing moves with dice: ~p",[Id, Dice]),
+                            gas:info(?MODULE,"TAVLABOT ~p Doing moves with dice: ~p",[Id, Dice]),
                             do_move(State,Dice,TableId,MyColor), State#state{moves = State#state.moves + 1};
                         [_C] ->
-                            ?INFO("TAVLABOT ~p Ignore the roll (first move competition)",[Id]),
+                            gas:info(?MODULE,"TAVLABOT ~p Ignore the roll (first move competition)",[Id]),
                             State
                       end;
-                _  -> ?INFO("TAVLABOT ~p Ignore the roll (another color)",[Id]), State
+                _  -> gas:info(?MODULE,"TAVLABOT ~p Ignore the roll (another color)",[Id]), State
             end,
             tavla_client_loop(State2);
             _ -> tavla_client_loop(State) end;
         #game_event{event = <<"player_left">>, args = Params} = Msg ->
             TableId = proplists:get_value(table_id, Params, 0),
             case TableId == State#state.table_id of true ->
-            ?INFO("TAVLABOT ~p : Received message: ~p", [Id, Msg]),
+            gas:info(?MODULE,"TAVLABOT ~p : Received message: ~p", [Id, Msg]),
             Replaced = proplists:get_value(bot_replaced, Params, false) orelse
                        proplists:get_value(human_replaced, Params, false),
             case Replaced of
@@ -340,37 +340,37 @@ tavla_client_loop(State) -> % incapsulate tavla protocol
             end;
             _ -> tavla_client_loop(State) end;
         #game_event{event = <<"tavla_game_info">>, args = Args} = Msg->
-            ?INFO("TAVLABOT ~p : Received message: ~p", [Id, Msg]),
+            gas:info(?MODULE,"TAVLABOT ~p : Received message: ~p", [Id, Msg]),
              User = State#state.user,
              Mode = proplists:get_value(game_mode, Args),
              TableId = proplists:get_value(table_id, Args),
-             ?INFO("TAVLABOT game_info ~p ~p",[self(),User]),
+             gas:info(?MODULE,"TAVLABOT game_info ~p ~p",[self(),User]),
              Players = proplists:get_value(players, Args),
              SeriesConfirmMode = proplists:get_value(series_confirmation_mode, Args),
-             ?INFO("TAVLABOT players: ~p",[Players]),
+             gas:info(?MODULE,"TAVLABOT players: ~p",[Players]),
              Delay = get_delay(fast),
              CatchTID = case User == undefined of
                             false -> FoundMyself = lists:keyfind(User#'PlayerInfo'.id,#'PlayerInfo'.id,Players),
                                     case FoundMyself of false -> State#state.table_id; _ -> TableId end;
-                            true -> ?INFO("ERROR USER in ~p is not set!",[self()]), undefined
+                            true -> gas:info(?MODULE,"ERROR USER in ~p is not set!",[self()]), undefined
                         end,
              tavla_client_loop( State#state{table_id = CatchTID, delay = Delay, mode = Mode,
                                             players = Players, confirmation = SeriesConfirmMode});
         #game_event{event = <<"tavla_series_ended">>, args = Params} = Msg->
             TableId = proplists:get_value(table_id, Params, 0),
             case TableId == State#state.table_id of true ->
-            ?INFO("TAVLABOT ~p : Received message: ~p", [Id, Msg]),
+            gas:info(?MODULE,"TAVLABOT ~p : Received message: ~p", [Id, Msg]),
             tavla_client_loop(State);
             _ -> tavla_client_loop(State) end;
         #game_event{event = <<"tavla_game_ended">>, args = Params} = Msg->
             TableId = proplists:get_value(table_id, Params, 0),
             case TableId == State#state.table_id of true ->
-            ?INFO("TAVLABOT ~p : Received message: ~p", [Id, Msg]),
+            gas:info(?MODULE,"TAVLABOT ~p : Received message: ~p", [Id, Msg]),
             say_ready(State,TableId),
             tavla_client_loop(State);
             _ -> tavla_client_loop(State) end;
         Msg ->
-            ?INFO("TAVLABOT ~p Received UNKNOWN message: ~p",[Id, Msg]),
+            gas:info(?MODULE,"TAVLABOT ~p Received UNKNOWN message: ~p",[Id, Msg]),
             tavla_client_loop(State)
     end.
 
@@ -401,8 +401,8 @@ follow_board(Board,From,To,PlayerColor) -> % track the moves to keep board consi
           From -> case Cell of
                        {_Color,1} -> {{0,0},null};
                        {Color,Count} -> {{0,0},{Color,Count-1}};
-                       _ -> ?INFO("Board: ~p From ~p To ~p",[Board,From,To]),
-                            ?INFO("follow_board: cant move from empty slot"), exit(self(),kill), {{0,0},null}
+                       _ -> gas:info(?MODULE,"Board: ~p From ~p To ~p",[Board,From,To]),
+                            gas:info(?MODULE,"follow_board: cant move from empty slot"), exit(self(),kill), {{0,0},null}
                   end;
             To -> case Cell of
                        null -> case FromColor of 0 -> {{0,0},null}; _ -> {{0,0},{FromColor,1}} end;
@@ -412,8 +412,8 @@ follow_board(Board,From,To,PlayerColor) -> % track the moves to keep board consi
                                  true -> {{0,0},{Color,Count+1}};
                                  false -> case Count of
                                                1 when FromColor =/= 0 -> {{Color,1},{FromColor,1}};
-                                               _ -> ?INFO("Board: ~p From ~p To ~p",[Board,From,To]),
-                                                    ?INFO("follow_board: cant kick tower"), exit(self(),kill), {{0,0},{Color,Count}}
+                                               _ -> gas:info(?MODULE,"Board: ~p From ~p To ~p",[Board,From,To]),
+                                                    gas:info(?MODULE,"follow_board: cant kick tower"), exit(self(),kill), {{0,0},{Color,Count}}
                                           end
                             end
                   end;
@@ -426,7 +426,7 @@ follow_board(Board,From,To,PlayerColor) -> % track the moves to keep board consi
                        _ -> {KC,Sum+KA} 
                   end
             end,{0,0}, BoardWithKicks),
-%%    ?INFO("Kick: ~p",[{KickColor,KickAmount}]),
+%%    gas:info(?MODULE,"Kick: ~p",[{KickColor,KickAmount}]),
     NewBoard = [ case {No,KickColor} of
         {25,_} when KickColor =/= 0 -> case Cell of
                        null -> {KickColor,KickAmount};
@@ -453,7 +453,7 @@ make_decision(Board,Dices2,Color,TableId) -> % produces tavla moves
     [X,Y] = Dices2,
     Dices = case X =:= Y of true -> [X,X,X,X]; false -> Dices2 end,
     Decision = first_available_move(Board,Dices,Color,TableId),
-    ?INFO("Decision: ~p",[Decision]),
+    gas:info(?MODULE,"Decision: ~p",[Decision]),
     Decision.
 
 %% norm([A,B]) -> case A > B of true -> {A,B}; false -> {B,A} end.
@@ -509,16 +509,16 @@ reverse_board(Board,PlayerColor) ->
 first_available_move(RealBoard,Dice,Color,TableId) ->
     RelativeBoard = reverse_board(RealBoard,Color),
     F = fun(Die, {MovesAcc, BoardAcc, FailedDiceAcc}) ->
-%%                ?INFO("board: ~p", [BoardAcc]),
+%%                gas:info(?MODULE,"board: ~p", [BoardAcc]),
                 Tactic = tactical_criteria(BoardAcc, Color),
-%%                ?INFO("tactical criteria: ~p", [Tactic]),
+%%                gas:info(?MODULE,"tactical criteria: ~p", [Tactic]),
                 case find_move(Color, Die, Tactic, BoardAcc) of
                     {Move, NewBoard} -> {[Move | MovesAcc], NewBoard, FailedDiceAcc};
                     false -> {MovesAcc, BoardAcc, [Die | FailedDiceAcc]}
                 end
         end,
     {List, Board, FailedDice} = lists:foldl(F, {[], RelativeBoard, []}, Dice),
-%%    ?INFO("moves found: ~p",[{List, FailedDice}]),
+%%    gas:info(?MODULE,"moves found: ~p",[{List, FailedDice}]),
     [#'TavlaAtomicMove'{from=rel(From,Color), to=rel(To,Color)} || {From,To} <- lists:reverse(List)]  ++
         if length(FailedDice) == 0; length(FailedDice) == length(Dice) -> [];
            true -> first_available_move(reverse_board(Board,Color),FailedDice,Color,TableId) end.
@@ -530,24 +530,24 @@ find_move(Color, Die, Tactic, Board) ->
 
 find_move(_Color, _OppColor, _Die, _Tactic, _Board, []) -> false;
 find_move(Color, OppColor, Die, Tactic, Board, [{Cell, No} | Rest]) ->
-%%    ?INFO("checking pos: ~p", [{Cell, No, Die, Tactic}]),
+%%    gas:info(?MODULE,"checking pos: ~p", [{Cell, No, Die, Tactic}]),
     case {Cell, Tactic} of
-        {null,kicks} when No == Die -> ?INFO("found kick to empty: ~p",[{26,No}]), {{26,No}, follow_board(Board,26,No,Color)};
-        {{OppColor,1},kicks} when No == Die -> ?INFO("found kick kick: ~p",[{26,No}]), {{26,No}, follow_board(Board,26,No,Color)};
-        {{Color,_},kicks} when No == Die -> ?INFO("found kick over own: ~p",[{26,No}]), {{26,No}, follow_board(Board,26,No,Color)};
-        {{Color,_},finish} when No + Die >= 25 -> ?INFO("found finish move: ~p",[{No,27}]), {{No,27}, follow_board(Board,No,27,Color)};
+        {null,kicks} when No == Die -> gas:info(?MODULE,"found kick to empty: ~p",[{26,No}]), {{26,No}, follow_board(Board,26,No,Color)};
+        {{OppColor,1},kicks} when No == Die -> gas:info(?MODULE,"found kick kick: ~p",[{26,No}]), {{26,No}, follow_board(Board,26,No,Color)};
+        {{Color,_},kicks} when No == Die -> gas:info(?MODULE,"found kick over own: ~p",[{26,No}]), {{26,No}, follow_board(Board,26,No,Color)};
+        {{Color,_},finish} when No + Die >= 25 -> gas:info(?MODULE,"found finish move: ~p",[{No,27}]), {{No,27}, follow_board(Board,No,27,Color)};
         {{Color,_},Tactic} when (Tactic==race orelse Tactic==finish) andalso (No + Die < 25) ->
             case lists:nth(No+Die+1, Board) of
-                null -> ?INFO("found race to empty: ~p",[{No,No+Die}]), {{No,No+Die}, follow_board(Board,No,No+Die,Color)};
-                {Color,_} -> ?INFO("found race over own: ~p",[{No,No+Die}]), {{No,No+Die}, follow_board(Board,No,No+Die,Color)};
-                {OppColor,1} -> ?INFO("found race kick: ~p",[{No,No+Die}]), {{No,No+Die}, follow_board(Board,No,No+Die,Color)};
+                null -> gas:info(?MODULE,"found race to empty: ~p",[{No,No+Die}]), {{No,No+Die}, follow_board(Board,No,No+Die,Color)};
+                {Color,_} -> gas:info(?MODULE,"found race over own: ~p",[{No,No+Die}]), {{No,No+Die}, follow_board(Board,No,No+Die,Color)};
+                {OppColor,1} -> gas:info(?MODULE,"found race kick: ~p",[{No,No+Die}]), {{No,No+Die}, follow_board(Board,No,No+Die,Color)};
                 _ -> find_move(Color, OppColor, Die, Tactic, Board, Rest)
             end;
         _ -> find_move(Color, OppColor, Die, Tactic, Board, Rest)
     end.
 
 %% make_end_series(Color,TableId,Board) ->
-%%     lists:foldl(fun (A,Acc) -> ?INFO("~p / ~p~n",[A,Acc]), {Cell,No} = A, case Cell of null -> Acc; 
+%%     lists:foldl(fun (A,Acc) -> gas:info(?MODULE,"~p / ~p~n",[A,Acc]), {Cell,No} = A, case Cell of null -> Acc; 
 %%                                   {Color,Count} -> Acc ++
 %%     [ #'TavlaAtomicMove'{from=No, to=27} || X <- lists:seq(1,Count)]; _ -> Acc end
 %%                                  end, [], lists:sublist(lists:zip(Board,lists:seq(0,27)),1,27)  ).
@@ -605,14 +605,14 @@ do_move(State, Dices,TableId,PlayerColor) ->
     Decision = make_decision(State#state.board, Dices, PlayerColor,TableId),
     case Decision of
         [] ->
-            ?INFO("TAVLABOT ~p : No moves available. Do nothing", [Id]),
+            gas:info(?MODULE,"TAVLABOT ~p : No moves available. Do nothing", [Id]),
             no_moves;
         _ ->
-            ?INFO("TAVLABOT ~p : Moves: ~p", [Id, Decision]),
+            gas:info(?MODULE,"TAVLABOT ~p : Moves: ~p", [Id, Decision]),
             Resp = call_rpc(S, #game_action{game = GameId,
                                             action = tavla_move,
                                             args = [{table_id, TableId},{player, Id},{moves, Decision }]}),
-            ?INFO("TAVLABOT_DBG ~p : Server response: ~p", [Id, Resp]),
+            gas:info(?MODULE,"TAVLABOT_DBG ~p : Server response: ~p", [Id, Resp]),
             {ok, Decision, Resp}
     end.
 

+ 1 - 1
apps/server/src/tavla/game_tavla_ng_scoring.erl

@@ -51,7 +51,7 @@
 %%     RoundsNum = undefined | pos_integer()
 
 init(Mode, SeatsInfo, RoundsNum) ->
-    ?INFO("TAVLA_NG_SCORING init Mode: ~p SeatsInfo = ~p RoundsNum = ~p", [Mode, SeatsInfo, RoundsNum]),
+    gas:info(?MODULE,"TAVLA_NG_SCORING init Mode: ~p SeatsInfo = ~p RoundsNum = ~p", [Mode, SeatsInfo, RoundsNum]),
     true = lists:member(Mode, [?MODE_STANDARD, ?MODE_PAIRED]),
     true = is_integer(RoundsNum) orelse RoundsNum == undefined,
     SeatsNum = length(SeatsInfo),

+ 52 - 52
apps/server/src/tavla/game_tavla_ng_table.erl

@@ -174,9 +174,9 @@ init([GameId, TableId, Params]) ->
                    {observers_allowed, false},
                    {table, {?MODULE, self()}}],
     {ok, Relay} = ?RELAY:start(RelayParams),
-    [?INFO("TAVLA_NG_TABLE_DBG <~p,~p> Parameter <~p> : ~p", [GameId, TableId, P, V]) ||
+    [gas:info(?MODULE,"TAVLA_NG_TABLE_DBG <~p,~p> Parameter <~p> : ~p", [GameId, TableId, P, V]) ||
            {P, V} <- Params],
-    ?INFO("TAVLA_NG_TABLE <~p,~p> Started.", [GameId, TableId]),
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> Started.", [GameId, TableId]),
     parent_notify_table_created(Parent, TableId, Relay),
     {_, ParentPid} = Parent,
     ParentMonRef = erlang:monitor(process, ParentPid),
@@ -212,13 +212,13 @@ init([GameId, TableId, Params]) ->
 
 handle_event({parent_message, Message}, StateName,
              #state{game_id = GameId, table_id = TableId} = StateData) ->
-    ?INFO("TAVLA_NG_TABLE_DBG <~p,~p> Received message from the parent: ~p.",
+    gas:info(?MODULE,"TAVLA_NG_TABLE_DBG <~p,~p> Received message from the parent: ~p.",
           [GameId, TableId, Message]),
     handle_parent_message(Message, StateName, StateData);
 
 handle_event({relay_message, Message}, StateName,
              #state{game_id = GameId, table_id = TableId} =  StateData) ->
-    ?INFO("TAVLA_NG_TABLE_DBG <~p,~p> Received message from the relay: ~p.",
+    gas:info(?MODULE,"TAVLA_NG_TABLE_DBG <~p,~p> Received message from the relay: ~p.",
           [GameId, TableId, Message]),
     handle_relay_message(Message, StateName, StateData);
 
@@ -240,38 +240,38 @@ handle_sync_event(_Event, _From, StateName, StateData) ->
 
 handle_info({timeout, Magic}, ?STATE_FIRST_MOVE_COMPETITION,
             #state{timeout_magic = Magic, game_id = GameId, table_id = TableId} = StateData) ->
-    ?INFO("TAVLA_NG_TABLE <~p,~p> First move competition timeout. Do an automatic rolls.", [GameId, TableId]),
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> First move competition timeout. Do an automatic rolls.", [GameId, TableId]),
     do_first_move_competition_timeout_rolls(StateData);
 
 handle_info({timeout, Magic}, ?STATE_PLAYING,
             #state{timeout_magic = Magic, game_id = GameId, table_id = TableId} = StateData) ->
-    ?INFO("TAVLA_NG_TABLE <~p,~p> Move timeout. Do an automatic action(s).", [GameId, TableId]),
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> Move timeout. Do an automatic action(s).", [GameId, TableId]),
     do_timeout_moves(StateData);
 
 handle_info({round_timeout, Round}, ?STATE_PLAYING,
             #state{cur_round = Round, desk_state = DeskState, game_id = GameId,
                    table_id = TableId} = StateData) ->
-    ?INFO("TAVLA_NG_TABLE <~p,~p> Time to finish round ~p because of the "
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> Time to finish round ~p because of the "
           "round timeout.", [GameId, TableId, Round]),
     finalize_round(StateData#state{desk_state = DeskState#desk_state{finish_reason = timeout}});
 
 handle_info(set_timeout, ?STATE_PLAYING,
             #state{cur_round = Round, desk_state = DeskState, game_id = GameId,
                    table_id = TableId} = StateData) ->
-    ?INFO("TAVLA_NG_TABLE <~p,~p> Time to finish round ~p and the set because of "
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> Time to finish round ~p and the set because of "
           "the set timeout.", [GameId, TableId, Round]),
     finalize_round(StateData#state{desk_state = DeskState#desk_state{finish_reason = set_timeout}});
 
 handle_info(set_timeout, ?STATE_SET_FINISHED = StateName,
             #state{game_id = GameId, table_id = TableId} = StateData) ->
-    ?INFO("TAVLA_NG_TABLE <~p,~p> Time to finish the set because of the set timeout. "
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> Time to finish the set because of the set timeout. "
           "But the set is finished already. Ignoring", [GameId, TableId]),
     {next_state, StateName, StateData};
 
 handle_info(set_timeout, StateName,
             #state{game_id = GameId, table_id = TableId, scoring_state = ScoringState,
                    parent = Parent, players = Players, timeout_timer = TRef} = StateData) ->
-    ?INFO("TAVLA_NG_TABLE <~p,~p> Time to finish the set because of the set "
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> Time to finish the set because of the set "
           "timeout at state <~p>. The set is over", [GameId, TableId, StateName]),
     if TRef =/= undefined -> erlang:cancel_timer(TRef);
        true -> do_nothing end,
@@ -286,17 +286,17 @@ handle_info(set_timeout, StateName,
 handle_info({'DOWN', MonitorRef, _Type, _Object, Info}, _StateName,
              #state{game_id = GameId, table_id = TableId, parent_mon_ref = MonitorRef
                    } = StateData) ->
-    ?INFO("TAVLA_NG_TABLE_DBG <~p,~p> The parent is died with reason: ~p. Stopping",
+    gas:info(?MODULE,"TAVLA_NG_TABLE_DBG <~p,~p> The parent is died with reason: ~p. Stopping",
           [GameId, TableId, Info]),
     {stop, parent_died, StateData};
 
 handle_info(Info, StateName, #state{game_id = GameId, table_id = TableId} = StateData) ->
-    ?INFO("TAVLA_NG_TABLE_DBG <~p,~p> Unexpected message(info) received at state <~p>: ~p.",
+    gas:info(?MODULE,"TAVLA_NG_TABLE_DBG <~p,~p> Unexpected message(info) received at state <~p>: ~p.",
           [GameId, TableId, StateName, Info]),
     {next_state, StateName, StateData}.
 
 terminate(Reason, StateName, #state{game_id = GameId, table_id = TableId, relay = Relay}) ->
-    ?INFO("TAVLA_NG_TABLE_DBG <~p,~p> Shutting down at state: <~p>. Reason: ~p",
+    gas:info(?MODULE,"TAVLA_NG_TABLE_DBG <~p,~p> Shutting down at state: <~p>. Reason: ~p",
           [GameId, TableId, StateName, Reason]),
     relay_stop(Relay),
     ok.
@@ -342,8 +342,8 @@ handle_parent_message(start_round, ?STATE_WAITING_FOR_START,
                       #state{game_id = GameId, table_id = TableId, turn_timeout = TurnTimeout, game_mode = GameMode,
                              round_timeout = RoundTimeout, set_timeout = SetTimeout} = StateData) ->
     CurRound = 1,
-    ?INFO("TAVLA_NG_TABLE <~p,~p> Recieved the directive to start new round (~p)", [GameId, TableId, CurRound]),
-    ?INFO("TAVLA_NG_TABLE <~p,~p> The start color will be determined by the competition rolls", [GameId, TableId]),
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> Recieved the directive to start new round (~p)", [GameId, TableId, CurRound]),
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> The start color will be determined by the competition rolls", [GameId, TableId]),
     %% This fake desk state is needed because the order of the first move is not defined yet, so
     %% we can't use the desk module to create it.
     DeskState = #desk_state{state = undefined,
@@ -379,8 +379,8 @@ handle_parent_message(start_round, ?STATE_FINISHED,
                              set_timer = SetTRef, game_mode = GameMode} = StateData) ->
     NewCurRound = CurRound + 1,
     StartColor = opponent_color(LastStartColor),
-    ?INFO("TAVLA_NG_TABLE <~p,~p> Recieved the directive to start new round (~p)", [GameId, TableId, NewCurRound]),
-    ?INFO("TAVLA_NG_TABLE <~p,~p> Start color is ~p", [GameId, TableId, StartColor]),
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> Recieved the directive to start new round (~p)", [GameId, TableId, NewCurRound]),
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> Start color is ~p", [GameId, TableId, StartColor]),
     Params = [{home_hit_and_run, enabled},
               {bearoff_waste_moves, enabled},
               {first_move, StartColor}],
@@ -426,7 +426,7 @@ handle_parent_message(show_round_result, StateName,
                       #state{scoring_state = ScoringState,
                              game_id = GameId, table_id = TableId} = StateData) ->
     {FinishInfo, RoundScore, AchsPoints, TotalScore} = ?SCORING:last_round_result(ScoringState),
-    ?INFO("TAVLA_NG_TABLE <~p,~p> RoundScore: ~p Total score: ~p.", [GameId, TableId, RoundScore, TotalScore]),
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> RoundScore: ~p Total score: ~p.", [GameId, TableId, RoundScore, TotalScore]),
     Msg = case FinishInfo of
               {win, Winner, _Condition} ->
                   create_tavla_round_ended_win(Winner, RoundScore, TotalScore, AchsPoints,
@@ -480,7 +480,7 @@ handle_parent_message(disconnect_players, StateName,
 
 handle_parent_message({send_table_state, DestTableId, PlayerId, Ref}, StateName,
                       #state{game_id = GameId, table_id = TableId, parent = Parent} = StateData) ->
-    ?INFO("TAVLA_NG_TABLE <~p,~p>  Received request to send the table state events for player "
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p>  Received request to send the table state events for player "
           "<~p> (~p) at table ~p. Processing.",
           [GameId, TableId, PlayerId, Ref, DestTableId]),
     GI = create_tavla_game_info(StateData),
@@ -497,7 +497,7 @@ handle_parent_message({action, {competition_rolls, Die1, Die2} = Action},
                       ?STATE_FIRST_MOVE_COMPETITION = StateName,
                       #state{game_id = GameId, table_id = TableId,
                              desk_state = DeskState} = StateData) ->
-    ?INFO("TAVLA_NG_TABLE <~p,~p>  Parent action received in state <~p>: ~p. Processing.",
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p>  Parent action received in state <~p>: ~p. Processing.",
           [GameId, TableId, StateName, Action]),
 %%    publish_ge(create_tavla_rolls_die(?WHITE, Die1, StateData), StateData),
 %%    publish_ge(create_tavla_rolls_die(?BLACK, Die2, StateData), StateData),
@@ -508,7 +508,7 @@ handle_parent_message({action, {rolls, Color, Die1, Die2} = Action},
                       ?STATE_PLAYING = StateName,
                       #state{game_id = GameId, table_id = TableId,
                              relay = Relay, turn_timeout = TurnTimeout} = StateData) ->
-    ?INFO("TAVLA_NG_TABLE <~p,~p>  Parent action received in state <~p>: ~p. Processing.",
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p>  Parent action received in state <~p>: ~p. Processing.",
           [GameId, TableId, StateName, Action]),
     relay_publish_ge(Relay, create_tavla_next_turn(Color, StateData)),
     {TRef, Magic} = start_timer(TurnTimeout),
@@ -522,20 +522,20 @@ handle_parent_message({action, {rolls, Color, Die1, Die2} = Action},
 
 handle_parent_message({action, Action}, StateName,
                       #state{game_id = GameId, table_id = TableId} = StateData) ->
-    ?INFO("TAVLA_NG_TABLE <~p,~p>  Parent action received in state <~p>: ~p. Ignoring.",
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p>  Parent action received in state <~p>: ~p. Ignoring.",
           [GameId, TableId, StateName, Action]),
     {next_state, StateName, StateData};
 
 handle_parent_message({game_event, GameEvent}, StateName,
                       #state{game_id = GameId, table_id = TableId, relay = Relay} = StateData) ->
-    ?INFO("TAVLA_NG_TABLE <~p,~p>  A game event received from the parent in state <~p>: ~p. Publish it.",
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p>  A game event received from the parent in state <~p>: ~p. Publish it.",
           [GameId, TableId, StateName, GameEvent]),
     relay_publish_ge(Relay, GameEvent),
     {next_state, StateName, StateData};
 
 handle_parent_message({table_state_event, _PlayerId, SubscrId, StateEvent}, StateName,
                       #state{game_id = GameId, table_id = TableId, relay = Relay} = StateData) ->
-    ?INFO("TAVLA_NG_TABLE <~p,~p>  A table state event received from the parent in state <~p>: ~p.",
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p>  A table state event received from the parent in state <~p>: ~p.",
           [GameId, TableId, StateName, StateEvent]),
     send_to_subscriber_ge(Relay, SubscrId, StateEvent),
     {next_state, StateName, StateData};
@@ -554,7 +554,7 @@ handle_parent_message(Message, StateName,
 handle_relay_message({player_connected, PlayerId} = Msg, StateName,
                      #state{parent = Parent, game_id = GameId,
                             table_id = TableId, players = Players} = StateData) ->
-    ?INFO("TAVLA_NG_TABLE <~p,~p> Received nofitication from the relay: ~p", [GameId, TableId, Msg]),
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> Received nofitication from the relay: ~p", [GameId, TableId, Msg]),
     case get_player(PlayerId, Players) of
         {ok, Player} ->
             NewPlayers = store_player_rec(Player#player{connected = true}, Players),
@@ -580,7 +580,7 @@ handle_relay_message({subscriber_added, PlayerId, SubscrId} = Msg, StateName,
                      #state{relay = Relay, game_id = GameId, game_mode = GameMode,
                             table_id = TableId, tournament_table = TTable,
                             players = Players, parent = Parent} = StateData) ->
-    ?INFO("TAVLA_NG_TABLE <~p,~p> Received nofitication from the relay: ~p", [GameId, TableId, Msg]),
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> Received nofitication from the relay: ~p", [GameId, TableId, Msg]),
     IsValidPlayerId = case PlayerId of
                           observer -> true;
                           administrator -> true;
@@ -624,7 +624,7 @@ handle_player_action(#player{id = PlayerId, seat_num = SeatNum, user_id = UserId
                      #state{game_id = GameId, table_id = TableId} = StateData) ->
     try api_utils:to_known_record(Action, Args) of
         ExtAction ->
-            ?INFO("TAVLA_NG_TABLE <~p,~p> Player <~p> (~p) submit the game action: ~p.",
+            gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> Player <~p> (~p) submit the game action: ~p.",
                   [GameId, TableId, PlayerId, UserId, ExtAction]),
             do_action(SeatNum, ExtAction, From, StateName, StateData)
     catch
@@ -640,7 +640,7 @@ handle_player_action(#player{id = PlayerId, user_id = UserId},
                      StateName,
                      #state{table_id = TableId, game_id = GameId, timeout_timer = TRef,
                             pause_mode = PauseMode, relay = Relay} = StateData) ->
-    ?INFO("TAVLA_NG_TABLE <~p,~p> Received signal from player <~p> : ~p. PauseMode: ~p",
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> Received signal from player <~p> : ~p. PauseMode: ~p",
           [GameId, TableId, PlayerId, Signal, PauseMode]),
     case PauseMode of
         disabled ->
@@ -667,7 +667,7 @@ handle_player_action(#player{id = PlayerId, user_id = UserId},
                      #state{table_id = TableId, game_id = GameId, pause_mode = PauseMode,
                             relay = Relay, paused_statename = ResumedStateName,
                             paused_timeout_value = Timeout} = StateData) ->
-    ?INFO("TAVLA_NG_TABLE <~p,~p> Received signal from player <~p> : ~p. PauseMode: ~p",
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> Received signal from player <~p> : ~p. PauseMode: ~p",
           [GameId, TableId, PlayerId, Signal, PauseMode]),
     case PauseMode of
         disabled ->
@@ -687,7 +687,7 @@ handle_player_action(#player{id = PlayerId, user_id = UserId},
 handle_player_action(#player{id = PlayerId},
                      {signal, Signal}, _From, StateName,
                      #state{table_id = TableId, game_id = GameId} = StateData) ->
-    ?INFO("TAVLA_NG_TABLE <~p,~p> Received signal from player <~p> : ~p. Ignoring.",
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> Received signal from player <~p> : ~p. Ignoring.",
           [GameId, TableId, PlayerId, Signal]),
     {reply, ok, StateName, StateData};
 
@@ -702,7 +702,7 @@ handle_player_action(_Player, _Message, _From, StateName, StateData) ->
 do_action(SeatNum, #tavla_roll{}, From, ?STATE_FIRST_MOVE_COMPETITION = StateName,
           #state{game_id = GameId, table_id = TableId,
                  desk_state = DeskState, players = Players} = StateData) ->
-    ?INFO("TAVLA_NG_TABLE_DBG <~p,~p> Action tavla_roll{} Deskstate: ~p.",
+    gas:info(?MODULE,"TAVLA_NG_TABLE_DBG <~p,~p> Action tavla_roll{} Deskstate: ~p.",
           [GameId, TableId, DeskState]),
     #desk_state{dice = Dice} = DeskState,
     #player{color = Color} = get_player_by_seat_num(SeatNum, Players),
@@ -843,13 +843,13 @@ do_timeout_moves(#state{desk_rule_pid = Desk, desk_state = DeskState,
     [#player{user_id = UserId}] = find_players_by_color(CurColor, Players),
     case DeskStateName of
         state_wait_roll when GameMode == standard ->
-            ?INFO("TAVLA_NG_TABLE <~p,~p> Do automatic roll for player <~p> (~p)",
+            gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> Do automatic roll for player <~p> (~p)",
                   [GameId, TableId, CurColor, UserId]),
             {Die1, Die2} = random_dice(),
             {ok, Events1} = desk_player_action(Desk, CurColor, {roll, Die1, Die2}),
             case [E || {next_player, _} = E <- Events1] of
                 [] -> %% Player can move => rolls_moves_timeout
-                    ?INFO("TAVLA_NG_TABLE <~p,~p> Do automatic move with dice ~p for player <~p> (~p)",
+                    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> Do automatic move with dice ~p for player <~p> (~p)",
                           [GameId, TableId, {Die1, Die2}, CurColor, UserId]),
                     NewPipsList = pips_list(Die1, Die2),
                     Moves = find_moves(CurColor, NewPipsList, Board),
@@ -862,7 +862,7 @@ do_timeout_moves(#state{desk_rule_pid = Desk, desk_state = DeskState,
                     NewDeskState = DeskState#desk_state{pips_list = NewPipsList},
                     process_game_events(Events, StateData#state{desk_state = NewDeskState});
                 _ -> %% Only rolls_timeout
-                    ?INFO("TAVLA_NG_TABLE <~p,~p> No moves can be done for the dice ~p for player <~p> (~p)",
+                    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> No moves can be done for the dice ~p for player <~p> (~p)",
                           [GameId, TableId, {Die1, Die2}, CurColor, UserId]),
                     Events = [case E of
                                   {rolls, CurColor, D1, D2} ->
@@ -872,7 +872,7 @@ do_timeout_moves(#state{desk_rule_pid = Desk, desk_state = DeskState,
                     process_game_events(Events, StateData)
                 end;
         state_wait_move ->
-            ?INFO("TAVLA_NG_TABLE <~p,~p> Do rest automatic move with pips ~p for player <~p> (~p)",
+            gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> Do rest automatic move with pips ~p for player <~p> (~p)",
                   [GameId, TableId, PipsList, CurColor, UserId]),
             Moves = find_moves(CurColor, PipsList, Board),
             {ok, Events1} = desk_player_action(Desk, CurColor, {move, Moves}),
@@ -888,7 +888,7 @@ do_timeout_moves(#state{desk_rule_pid = Desk, desk_state = DeskState,
 
 do_parent_game_action(Color, GameAction,
                #state{desk_rule_pid = Desk} = StateData) ->
-    ?INFO("TAVLA_NG_TABLE do_parent_game_action Color: ~p  GameAction: ~p", [Color, GameAction]),
+    gas:info(?MODULE,"TAVLA_NG_TABLE do_parent_game_action Color: ~p  GameAction: ~p", [Color, GameAction]),
     case desk_player_action(Desk, Color, GameAction) of
         {ok, Events} ->
             {next_state, NewStateName, NewStateData} = process_game_events(Events, StateData),
@@ -900,16 +900,16 @@ do_parent_game_action(Color, GameAction,
 
 do_game_action(Color, GameAction, From, StateName,
                #state{game_id = GameId, table_id = TableId, desk_rule_pid = Desk} = StateData) ->
-    ?INFO("TAVLA_NG_TABLE <~p,~p> Appling the action: Color <~p>  GameAction: ~p",
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> Appling the action: Color <~p>  GameAction: ~p",
           [GameId, TableId, Color, GameAction]),
     case desk_player_action(Desk, Color, GameAction) of
         {ok, Events} ->
-            ?INFO("TAVLA_NG_TABLE <~p,~p> The game action applied successfully.",
+            gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> The game action applied successfully.",
                   [GameId, TableId]),
             gen_fsm:reply(From, ok),
             process_game_events(Events, StateData);
         {error, Reason} ->
-            ?INFO("TAVLA_NG_TABLE <~p,~p> The action was rejected by the reason: ~p",
+            gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> The action was rejected by the reason: ~p",
                   [GameId, TableId, Reason]),
             ExtError = desk_error_to_ext(Reason),
             {reply, ExtError, StateName, StateData}
@@ -955,7 +955,7 @@ finalize_round(#state{desk_state = #desk_state{finish_reason = FinishReason,
                       scoring_state = ScoringState, timeout_timer = TimeoutTRef,
                       round_timer = RoundTRef, parent = Parent, players = Players,
                       game_id = GameId, table_id = TableId, cur_round = CurRound} = StateData) ->
-    ?INFO("TAVLA_NG_TABLE <~p,~p> Finalizing the round. Finish reason: ~p. Finish info: ~p.",
+    gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> Finalizing the round. Finish reason: ~p. Finish info: ~p.",
           [GameId, TableId, FinishReason, FinishInfo]),
     if TimeoutTRef =/= undefined -> erlang:cancel_timer(TimeoutTRef);
        true -> do_nothing
@@ -986,11 +986,11 @@ finalize_round(#state{desk_state = #desk_state{finish_reason = FinishReason,
     TotalScorePl = [{get_player_id_by_seat_num(SeatNum, Players), Points} || {SeatNum, Points} <- TotalScore],
 
     if GameOver ->
-           ?INFO("TAVLA_NG_TABLE <~p,~p> The set is over.", [GameId, TableId]),
+           gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> The set is over.", [GameId, TableId]),
            parent_send_set_res(Parent, TableId, NewScoringState, RoundScorePl, TotalScorePl),
            {next_state, ?STATE_SET_FINISHED, NewStateData};
        true ->
-           ?INFO("TAVLA_NG_TABLE <~p,~p> Round <~p> is over.", [GameId, TableId, CurRound]),
+           gas:info(?MODULE,"TAVLA_NG_TABLE <~p,~p> Round <~p> is over.", [GameId, TableId, CurRound]),
            parent_send_round_res(Parent, TableId, NewScoringState, RoundScorePl, TotalScorePl),
            {next_state, ?STATE_FINISHED, NewStateData}
     end.
@@ -1004,13 +1004,13 @@ handle_desk_events([], DeskState, _StateData) ->
 
 handle_desk_events([Event | Events], DeskState,
                     #state{game_id = GameId, table_id = TableId} = StateData) ->
-    ?INFO("TAVLA_NG_TABLE_DBG <~p,~p> handle_desk_events/3 Event: ~p", [GameId, TableId, Event]),
+    gas:info(?MODULE,"TAVLA_NG_TABLE_DBG <~p,~p> handle_desk_events/3 Event: ~p", [GameId, TableId, Event]),
     #desk_state{board = Board,
                 pips_list = OldPipsList} = DeskState,
     NewDeskState =
         case Event of
             {rolls, Color, Die1, Die2} ->
-                ?INFO("TAVLA_NG_TABLE_DBG <~p,~p> Board: Color <~p> rolls(himself): ~p", [GameId, TableId, Color, {Die1, Die2}]),
+                gas:info(?MODULE,"TAVLA_NG_TABLE_DBG <~p,~p> Board: Color <~p> rolls(himself): ~p", [GameId, TableId, Color, {Die1, Die2}]),
                 publish_ge(create_tavla_rolls_dice(Color, {Die1, Die2}, StateData), StateData),
                 PipsList = pips_list(Die1, Die2),
                 DeskState#desk_state{state = state_wait_move,
@@ -1020,31 +1020,31 @@ handle_desk_events([Event | Events], DeskState,
                    {Type, From, To, Pips} <- Moves],
                 UsedPipsList = [Pips || {_Type, _From, _To, Pips} <- Moves],
                 NewBoard = apply_moves(Color, Moves, Board),
-                ?INFO("TAVLA_NG_TABLE_DBG <~p,~p> Board: Color <~p> moves(himself): ~p", [GameId, TableId, Color, Moves]),
+                gas:info(?MODULE,"TAVLA_NG_TABLE_DBG <~p,~p> Board: Color <~p> moves(himself): ~p", [GameId, TableId, Color, Moves]),
                 show_boards(GameId, TableId, Board, NewBoard),
                 DeskState#desk_state{board = NewBoard, pips_list = OldPipsList -- UsedPipsList};
             {rolls_timeout, Color, Die1, Die2} -> %% Injected event
-                ?INFO("TAVLA_NG_TABLE_DBG <~p,~p> Board: Color <~p> rolls(auto): ~p", [GameId, TableId, Color, {Die1, Die2}]),
+                gas:info(?MODULE,"TAVLA_NG_TABLE_DBG <~p,~p> Board: Color <~p> rolls(auto): ~p", [GameId, TableId, Color, {Die1, Die2}]),
                 Msg = create_tavla_turn_timeout(Color, {Die1, Die2}, _Moves = [], StateData),
                 publish_ge(Msg, StateData),
                 DeskState#desk_state{dice = {Die1, Die2}};
             {rolls_moves_timeout, Color, Die1, Die2, Moves} -> %% Injected event
-                ?INFO("TAVLA_NG_TABLE_DBG <~p,~p> Board: Color <~p> rolls(auto): ~p", [GameId, TableId, Color, {Die1, Die2}]),
+                gas:info(?MODULE,"TAVLA_NG_TABLE_DBG <~p,~p> Board: Color <~p> rolls(auto): ~p", [GameId, TableId, Color, {Die1, Die2}]),
                 Msg = create_tavla_turn_timeout(Color, {Die1, Die2}, Moves, StateData),
                 publish_ge(Msg, StateData),
                 NewBoard = apply_moves(Color, Moves, Board),
-                ?INFO("TAVLA_NG_TABLE_DBG <~p,~p> Board: Color <~p> moves(auto): ~p", [GameId, TableId, Color, Moves]),
+                gas:info(?MODULE,"TAVLA_NG_TABLE_DBG <~p,~p> Board: Color <~p> moves(auto): ~p", [GameId, TableId, Color, Moves]),
                 show_boards(GameId, TableId, Board, NewBoard),
                 DeskState#desk_state{dice = {Die1, Die2}, board = NewBoard};
             {moves_timeout, Color, Moves} ->    %% Injected event
                 Msg = create_tavla_turn_timeout(Color, _Dice = undefined, Moves, StateData),
                 publish_ge(Msg, StateData),
                 NewBoard = apply_moves(Color, Moves, Board),
-                ?INFO("TAVLA_NG_TABLE_DBG <~p,~p> Board: Color <~p> moves(auto): ~p", [GameId, TableId, Color, Moves]),
+                gas:info(?MODULE,"TAVLA_NG_TABLE_DBG <~p,~p> Board: Color <~p> moves(auto): ~p", [GameId, TableId, Color, Moves]),
                 show_boards(GameId, TableId, Board, NewBoard),
                 DeskState#desk_state{board = NewBoard};
             {next_player, Color} ->
-                ?INFO("TAVLA_NG_TABLE_DBG <~p,~p> Board: Waiting for Color <~p> roll...", [GameId, TableId, Color]),
+                gas:info(?MODULE,"TAVLA_NG_TABLE_DBG <~p,~p> Board: Waiting for Color <~p> roll...", [GameId, TableId, Color]),
                 Msg = create_tavla_next_turn(Color, StateData),
                 publish_ge(Msg, StateData),
                 DeskState#desk_state{state = state_wait_roll, cur_color = Color,
@@ -1063,7 +1063,7 @@ show_boards(GameId, TableId, Board1, Board2) ->
     B2 = ?LIB:board_to_text4(Board2),
     M = ["    ", "    ", "    ", " => " ,"    ", "    ", "    "],
     T = lists:zip3(B1, M, B2),
-    [?INFO("TAVLA_NG_TABLE_DBG <~p,~p> Board: ~s~s~s", [GameId, TableId, S1, S2, S3])
+    [gas:info(?MODULE,"TAVLA_NG_TABLE_DBG <~p,~p> Board: ~s~s~s", [GameId, TableId, S1, S2, S3])
      || {S1, S2, S3} <- T].
 
 %%===================================================================
@@ -1594,7 +1594,7 @@ players_ext_color_info(Players) ->
      end || C <- [?WHITE, ?BLACK]].
 
 board_to_ext(Board) ->
-%%    ?INFO("board_to_ext Board: ~p", [Board]),
+%%    gas:info(?MODULE,"board_to_ext Board: ~p", [Board]),
     Order = [?WHITE_OUT] ++ lists:seq(1, 24) ++ [?WHITE_BAR, ?BLACK_BAR, ?BLACK_OUT],
     [case lists:keyfind(Pos, 1, Board) of
          {_, empty} -> null;

+ 63 - 63
apps/server/src/tavla/game_tavla_ng_trn_paired.erl

@@ -172,7 +172,7 @@ client_request(Pid, Message, Timeout) ->
 %% ====================================================================
 
 init([GameId, Params, _Manager]) ->
-    ?INFO("TRN_PAIRED <~p> Init started",[GameId]),
+    gas:info(?MODULE,"TRN_PAIRED <~p> Init started",[GameId]),
     Registrants =   get_param(registrants, Params),
     GameMode =      get_param(game_mode, Params),
     GameName =      get_param(game_name, Params),
@@ -188,9 +188,9 @@ init([GameId, Params, _Manager]) ->
     BotsReplacementMode = get_param(bots_replacement_mode, Params),
     CommonParams  = get_param(common_params, Params),
 
-    [?INFO("TRN_PAIRED_DBG <~p> Parameter <~p> : ~p", [GameId, P, V]) || {P, V} <- Params],
+    [gas:info(?MODULE,"TRN_PAIRED_DBG <~p> Parameter <~p> : ~p", [GameId, P, V]) || {P, V} <- Params],
 
-    ?INFO("TRN_PAIRED <~p> started.  Pid:~p", [GameId, self()]),
+    gas:info(?MODULE,"TRN_PAIRED <~p> started.  Pid:~p", [GameId, self()]),
 
     gen_fsm:send_all_state_event(self(), go),
     {ok, ?STATE_INIT, #state{game_id = GameId,
@@ -216,7 +216,7 @@ init([GameId, Params, _Manager]) ->
 handle_event(go, ?STATE_INIT, #state{game_id = GameId, registrants = Registrants,
                                      game_type = GameType, bot_module = BotModule,
                                      common_params = CommonParams} = StateData) ->
-    ?INFO("TRN_PAIRED <~p> Received a directive to starting the game.", [GameId]),
+    gas:info(?MODULE,"TRN_PAIRED <~p> Received a directive to starting the game.", [GameId]),
     DeclRec = create_decl_rec(GameType, CommonParams, GameId, Registrants),
     gproc:reg({p,l,self()}, DeclRec),
     {Players, PlayerIdCounter} = setup_players(Registrants, GameId, BotModule),
@@ -225,24 +225,24 @@ handle_event(go, ?STATE_INIT, #state{game_id = GameId, registrants = Registrants
    init_tour(1, NewStateData);
 
 handle_event({client_message, Message}, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_PAIRED_DBG <~p> Received the message from a client: ~p.", [GameId, Message]),
+    gas:info(?MODULE,"TRN_PAIRED_DBG <~p> Received the message from a client: ~p.", [GameId, Message]),
     handle_client_message(Message, StateName, StateData);
 
 handle_event({table_message, TableId, Message}, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_PAIRED_DBG <~p> Received the message from table <~p>: ~p.", [GameId, TableId, Message]),
+    gas:info(?MODULE,"TRN_PAIRED_DBG <~p> Received the message from table <~p>: ~p.", [GameId, TableId, Message]),
     handle_table_message(TableId, Message, StateName, StateData);
 
 handle_event(Message, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_PAIRED_DBG <~p> Unhandled message(event) received in state <~p>: ~p.",
+    gas:info(?MODULE,"TRN_PAIRED_DBG <~p> Unhandled message(event) received in state <~p>: ~p.",
           [GameId, StateName, Message]),
     {next_state, StateName, StateData}.
 
 handle_sync_event({client_request, Request}, From, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_PAIRED_DBG <~p> Received the request from a client: ~p.", [GameId, Request]),
+    gas:info(?MODULE,"TRN_PAIRED_DBG <~p> Received the request from a client: ~p.", [GameId, Request]),
     handle_client_request(Request, From, StateName, StateData);
 
 handle_sync_event(Request, From, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_PAIRED_DBG <~p> Unhandled request(event) received in state <~p> from ~p: ~p.",
+    gas:info(?MODULE,"TRN_PAIRED_DBG <~p> Unhandled request(event) received in state <~p> from ~p: ~p.",
           [GameId, StateName, From, Request]),
     {reply, {error, unknown_request}, StateName, StateData}.
 
@@ -252,7 +252,7 @@ handle_info({'DOWN', MonRef, process, _Pid, _}, StateName,
             #state{game_id = GameId, tables = Tables} = StateData) ->
     case get_table_by_mon_ref(MonRef, Tables) of
         #table{id = TableId} ->
-            ?INFO("TRN_PAIRED <~p> Table <~p> is down. Stopping", [GameId, TableId]),
+            gas:info(?MODULE,"TRN_PAIRED <~p> Table <~p> is down. Stopping", [GameId, TableId]),
             %% TODO: More smart handling (failover) needed
             {stop, {one_of_tables_down, TableId}, StateData};
         not_found ->
@@ -262,7 +262,7 @@ handle_info({'DOWN', MonRef, process, _Pid, _}, StateName,
 
 handle_info({timeout, Magic}, ?STATE_WAITING_FOR_PLAYERS,
             #state{timer_magic = Magic, game_id = GameId} = StateData) ->
-    ?INFO("TRN_PAIRED <~p> Time to start the tour.", [GameId]),
+    gas:info(?MODULE,"TRN_PAIRED <~p> Time to start the tour.", [GameId]),
     start_tour(StateData);
 
 handle_info({timeout, Magic}, ?STATE_TOUR_PROCESSING,
@@ -271,25 +271,25 @@ handle_info({timeout, Magic}, ?STATE_TOUR_PROCESSING,
                    bot_module = BotModule, player_id_counter = PlayerIdCounter,
                    game_type = GameType, common_params = CommonParams,
                    tab_requests = Requests} = StateData) ->
-    ?INFO("TRN_PAIRED <~p> Time to start new round. Checking start conditions...", [GameId]),
+    gas:info(?MODULE,"TRN_PAIRED <~p> Time to start new round. Checking start conditions...", [GameId]),
     DisconnectedSeats = find_disconnected_seats(Seats),
     DisconnectedPlayers = [PlayerId || #seat{player_id = PlayerId} <- DisconnectedSeats],
     ConnectedRealPlayers = [PlayerId || #player{id = PlayerId, is_bot = false} <- players_to_list(Players),
                                         not lists:member(PlayerId, DisconnectedPlayers)],
     case ConnectedRealPlayers of
         [] -> %% Finish game
-            ?INFO("TRN_PAIRED <~p> No real players left in tournament. "
+            gas:info(?MODULE,"TRN_PAIRED <~p> No real players left in tournament. "
                   "Stopping the game.", [GameId]),
             finalize_tables_with_disconnect(TableModule, Tables),
             {stop, normal, StateData#state{tables = [], seats = []}};
         _ -> %% Replace disconnected players by bots and start the round
-            ?INFO("TRN_PAIRED <~p> Enough real players in the game to continue. "
+            gas:info(?MODULE,"TRN_PAIRED <~p> Enough real players in the game to continue. "
                   "Replacing disconnected players by bots.", [GameId]),
             {Replacements, NewPlayers, NewSeats, NewPlayerIdCounter} =
                 replace_by_bots(DisconnectedSeats, GameId, BotModule, Players, Seats, PlayerIdCounter),
             NewRequests = req_replace_players(TableModule, Tables, Replacements, Requests),
             update_gproc(GameId, GameType, CommonParams, NewPlayers),
-            ?INFO("TRN_PAIRED <~p> The replacement is completed.", [GameId]),
+            gas:info(?MODULE,"TRN_PAIRED <~p> The replacement is completed.", [GameId]),
             start_round(StateData#state{tab_requests = NewRequests,
                                         players = NewPlayers,
                                         seats = NewSeats,
@@ -298,24 +298,24 @@ handle_info({timeout, Magic}, ?STATE_TOUR_PROCESSING,
 
 handle_info({timeout, Magic}, ?STATE_TOUR_FINISHED,
             #state{timer_magic = Magic, game_id = GameId} = StateData) ->
-    ?INFO("TRN_PAIRED <~p> Time to finalize the tour.", [GameId]),
+    gas:info(?MODULE,"TRN_PAIRED <~p> Time to finalize the tour.", [GameId]),
     finalize_tour(StateData);
 
 handle_info({timeout, Magic}, ?STATE_SHOW_TOUR_RESULT,
             #state{timer_magic = Magic, game_id = GameId} = StateData) ->
-    ?INFO("TRN_PAIRED <~p> Time to finalize the game.", [GameId]),
+    gas:info(?MODULE,"TRN_PAIRED <~p> Time to finalize the game.", [GameId]),
     finalize_tournament(StateData);
 
 handle_info({publish_series_result, TableId}, StateName,
             #state{game_id = GameId, tables = Tables, table_module = TableModule,
                    series_results = SeriesResults} = StateData) ->
-    ?INFO("TRN_PAIRED <~p> Time to publish the series result for table <~p>.", [GameId, TableId]),
+    gas:info(?MODULE,"TRN_PAIRED <~p> Time to publish the series result for table <~p>.", [GameId, TableId]),
     case fetch_table(TableId, Tables) of
         #table{state = ?TABLE_STATE_FINISHED, pid = TablePid} ->
             {_, SeriesResult} = lists:keyfind(TableId, 1, SeriesResults),
             send_to_table(TableModule, TablePid, {show_series_result, SeriesResult});
         _ ->
-            ?INFO("TRN_PAIRED <~p> Don't publish the series result because the state of table <~p> "
+            gas:info(?MODULE,"TRN_PAIRED <~p> Don't publish the series result because the state of table <~p> "
                   "is not 'finished'.", [GameId, TableId])
     end,
     {next_state, StateName, StateData};
@@ -323,20 +323,20 @@ handle_info({publish_series_result, TableId}, StateName,
 %% handle_info({timeout, Magic}, ?STATE_FINISHED,
 %%             #state{timer_magic = Magic, tables = Tables, game_id = GameId,
 %%                    table_module = TableModule} = StateData) ->
-%%     ?INFO("TRN_PAIRED <~p> Time to stopping the tournament.", [GameId]),
+%%     gas:info(?MODULE,"TRN_PAIRED <~p> Time to stopping the tournament.", [GameId]),
 %%     finalize_tables_with_disconnect(TableModule, Tables),
 %%     {stop, normal, StateData#state{tables = [], seats = []}};
 
 
 handle_info(Message, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_PAIRED <~p> Unhandled message(info) received in state <~p>: ~p.",
+    gas:info(?MODULE,"TRN_PAIRED <~p> Unhandled message(info) received in state <~p>: ~p.",
           [GameId, StateName, Message]),
     {next_state, StateName, StateData}.
 
 %%===================================================================
 
 terminate(_Reason, _StateName, #state{game_id=GameId}=_StatData) ->
-    ?INFO("TRN_PAIRED <~p> Shutting down at state: <~p>. Reason: ~p",
+    gas:info(?MODULE,"TRN_PAIRED <~p> Shutting down at state: <~p>. Reason: ~p",
           [GameId, _StateName, _Reason]),
     ok.
 
@@ -351,7 +351,7 @@ code_change(_OldVsn, StateName, StateData, _Extra) ->
 
 
 handle_client_message(Message, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_PAIRED <~p> Unhandled client message received in "
+    gas:info(?MODULE,"TRN_PAIRED <~p> Unhandled client message received in "
           "state <~p>: ~p.", [GameId, StateName, Message]),
     {next_state, StateName, StateData}.
 
@@ -438,7 +438,7 @@ handle_table_message(TableId, {round_finished, NewScoringState, _RoundScore, _To
                      ?STATE_TOUR_PROCESSING = StateName,
                      #state{game_id = GameId, tables = Tables, table_module = TableModule,
                             tables_wl = WL} = StateData) ->
-    ?INFO("TRN_PAIRED <~p> Round is finished (table <~p>).", [GameId, TableId]),
+    gas:info(?MODULE,"TRN_PAIRED <~p> Round is finished (table <~p>).", [GameId, TableId]),
     #table{pid = TablePid} = Table = fetch_table(TableId, Tables),
     NewTable = Table#table{context = NewScoringState, state = ?TABLE_STATE_WAITING_NEW_ROUND},
     NewTables = store_table(NewTable, Tables),
@@ -465,7 +465,7 @@ handle_table_message(TableId, {game_finished, TableContext, _RoundScore, TableSc
                             kakush_for_winners = KakushForWinners, kakush_for_loser = KakushForLoser,
                             win_game_points = WinGamePoints, players = Players,
                             series_results = SeriesResults} = StateData) ->
-    ?INFO("TRN_PAIRED <~p> Last round of the set is finished (table <~p>).", [GameId, TableId]),
+    gas:info(?MODULE,"TRN_PAIRED <~p> Last round of the set is finished (table <~p>).", [GameId, TableId]),
     NewTablesResults = [{TableId, TableScore} | TablesResults],
     #table{pid = TablePid} = Table = fetch_table(TableId, Tables),
     NewTable = Table#table{context = TableContext, state = ?TABLE_STATE_FINISHED},
@@ -476,10 +476,10 @@ handle_table_message(TableId, {game_finished, TableContext, _RoundScore, TableSc
        || #table{pid = TPid, state = ?TABLE_STATE_FINISHED} <- tables_to_list(Tables)],
     SeriesResult = series_result(TableScore),
     NewSeriesResults = [{TableId, SeriesResult} | SeriesResults],
-    ?INFO("TRN_PAIRED <~p> Set result: ~p", [GameId, SeriesResult]),
+    gas:info(?MODULE,"TRN_PAIRED <~p> Set result: ~p", [GameId, SeriesResult]),
     Points = calc_players_prize_points(SeriesResult, KakushForWinners, KakushForLoser, WinGamePoints, MulFactor, Players),
     UsersPrizePoints = prepare_users_prize_points(Points, Players),
-    ?INFO("TRN_PAIRED <~p> Prizes: ~p", [GameId, UsersPrizePoints]),
+    gas:info(?MODULE,"TRN_PAIRED <~p> Prizes: ~p", [GameId, UsersPrizePoints]),
     add_points_to_accounts(UsersPrizePoints, GameId, GameType, GameMode, MulFactor),
     NewStateData = StateData#state{tables = NewTables,
                                    tables_results = NewTablesResults,
@@ -501,7 +501,7 @@ handle_table_message(TableId, {response, RequestId, Response},
     NewTabRequests = dict:erase(RequestId, TabRequests),
     case dict:find(RequestId, TabRequests) of
         {ok, ReqContext} ->
-            ?INFO("TRN_PAIRED <~p> The a response received from table <~p>. "
+            gas:info(?MODULE,"TRN_PAIRED <~p> The a response received from table <~p>. "
                   "RequestId: ~p. Request context: ~p. Response: ~p",
                   [GameId, TableId, RequestId, ReqContext, Response]),
             handle_table_response(TableId, ReqContext, Response, StateName,
@@ -519,7 +519,7 @@ handle_table_message(TableId, {game_event, #tavla_next_turn{table_id = TableId,
                      #state{cur_color = CurColor, next_turn_wl = NextTurnWL,
                             game_id = GameId} = StateData) ->
     Color = ext_to_color(ExtColor),
-    ?INFO("TRN_PAIRED <~p> The 'tavla_next_turn event' received from table <~p>. "
+    gas:info(?MODULE,"TRN_PAIRED <~p> The 'tavla_next_turn event' received from table <~p>. "
           "Color: ~p. CurColor: ~p, WaitList: ~p",
           [GameId, TableId, Color, CurColor, NextTurnWL]),
     true = opponent(CurColor) == Color, %% Assert 
@@ -544,7 +544,7 @@ handle_table_message(_TableId, {table_state_event, DestTableId, PlayerId, Ref, S
     {next_state, StateName, StateData};
 
 handle_table_message(TableId, Message, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_PAIRED <~p> Unhandled table message received from table <~p> in "
+    gas:info(?MODULE,"TRN_PAIRED <~p> Unhandled table message received from table <~p> in "
           "state <~p>: ~p.", [GameId, TableId, StateName, Message]),
     {next_state, StateName, StateData}.
 
@@ -587,7 +587,7 @@ handle_table_response(_TableId, {replace_player, PlayerId, TableId, SeatNum}, ok
 
 handle_table_response(TableId, RequestContext, Response, StateName,
                       #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_PAIRED <~p> Unhandled 'table response' received from table <~p> "
+    gas:info(?MODULE,"TRN_PAIRED <~p> Unhandled 'table response' received from table <~p> "
           "in state <~p>. Request context: ~p. Response: ~p.",
           [GameId, TableId, StateName, RequestContext, Response]),
     {next_state, StateName, StateData}.
@@ -600,51 +600,51 @@ handle_client_request({join, UserInfo}, From, StateName,
                              bots_replacement_mode = BotsReplacementMode,
                              table_module = TableMod} = StateData) ->
     #'PlayerInfo'{id = UserId, robot = _IsBot} = UserInfo,
-    ?INFO("TRN_PAIRED <~p> The 'Join' request received from user: ~p.", [GameId, UserId]),
+    gas:info(?MODULE,"TRN_PAIRED <~p> The 'Join' request received from user: ~p.", [GameId, UserId]),
     if StateName == ?STATE_FINISHED ->
-           ?INFO("TRN_PAIRED <~p> The game is finished. "
+           gas:info(?MODULE,"TRN_PAIRED <~p> The game is finished. "
                  "Reject to join user ~p.", [GameId, UserId]),
            {reply, {error, finished}, StateName, StateData};
        true -> %% Game in progress. Find a seat for the user
            case get_player_by_user_id(UserId, Players) of
                {ok, #player{id = PlayerId}} -> %% The user is a registered member of the game (player)
-                   ?INFO("TRN_PAIRED <~p> User ~p is a registered member of the game. "
+                   gas:info(?MODULE,"TRN_PAIRED <~p> User ~p is a registered member of the game. "
                          "Allow to join.", [GameId, UserId]),
                    [#seat{table = TableId, registered_by_table = RegByTable}] = find_seats_by_player_id(PlayerId, Seats),
                    case RegByTable of
                        false -> %% The player is not registered by the table yet
-                           ?INFO("TRN_PAIRED <~p> User ~p not yet regirested by the table. "
+                           gas:info(?MODULE,"TRN_PAIRED <~p> User ~p not yet regirested by the table. "
                                  "Add the request to the waiting pool.", [GameId, UserId]),
                            NewRegRequests = dict:store(PlayerId, From, RegRequests),
                            {next_state, StateName, StateData#state{reg_requests = NewRegRequests}};
                        _ -> %% The player is registered by the table. Return the table requisites
-                           ?INFO("TRN_PAIRED <~p> Return the join response for player ~p immediately.",
+                           gas:info(?MODULE,"TRN_PAIRED <~p> Return the join response for player ~p immediately.",
                                  [GameId, UserId]),
                            #table{relay = Relay, pid = TPid} = fetch_table(TableId, Tables),
                            {reply, {ok, {PlayerId, Relay, {TableMod, TPid}}}, StateName, StateData}
                    end;
                error -> %% Not a member yet
-                   ?INFO("TRN_PAIRED <~p> User ~p is not a member of the game.", [GameId, UserId]),
+                   gas:info(?MODULE,"TRN_PAIRED <~p> User ~p is not a member of the game.", [GameId, UserId]),
                    case find_free_seats(Seats) of
                        [] when BotsReplacementMode == disabled ->
-                           ?INFO("TRN_PAIRED <~p> No free seats for user ~p. Robots replacement is disabled. "
+                           gas:info(?MODULE,"TRN_PAIRED <~p> No free seats for user ~p. Robots replacement is disabled. "
                                  "Reject to join.", [GameId, UserId]),
                            {reply, {error, not_allowed}, StateName, StateData};
                        [] when BotsReplacementMode == enabled ->
-                           ?INFO("TRN_PAIRED <~p> No free seats for user ~p. Robots replacement is enabled. "
+                           gas:info(?MODULE,"TRN_PAIRED <~p> No free seats for user ~p. Robots replacement is enabled. "
                                  "Tring to find a robot for replace.", [GameId, UserId]),
                            case find_registered_robot_seats(Seats) of
                                [] ->
-                                   ?INFO("TRN_PAIRED <~p> No robots for replacement by user ~p. "
+                                   gas:info(?MODULE,"TRN_PAIRED <~p> No robots for replacement by user ~p. "
                                          "Reject to join.", [GameId, UserId]),
                                    {reply, {error, not_allowed}, StateName, StateData};
                                [#seat{table = TableId, seat_num = SeatNum, player_id = OldPlayerId} | _] ->
-                                   ?INFO("TRN_PAIRED <~p> There is a robot for replacement by user ~p. "
+                                   gas:info(?MODULE,"TRN_PAIRED <~p> There is a robot for replacement by user ~p. "
                                          "Registering.", [GameId, UserId]),
                                    reg_player_with_replace(UserInfo, TableId, SeatNum, OldPlayerId, From, StateName, StateData)
                            end;
                        [#seat{table = TableId, seat_num = SeatNum} | _] ->
-                           ?INFO("TRN_PAIRED <~p> There is a free seat for user ~p. "
+                           gas:info(?MODULE,"TRN_PAIRED <~p> There is a free seat for user ~p. "
                                  "Registering.", [GameId, UserId]),
                            reg_new_player(UserInfo, TableId, SeatNum, From, StateName, StateData)
                    end
@@ -652,7 +652,7 @@ handle_client_request({join, UserInfo}, From, StateName,
     end;
 
 handle_client_request(Request, From, StateName, #state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_PAIRED <~p> Unhandled client request received from ~p in "
+    gas:info(?MODULE,"TRN_PAIRED <~p> Unhandled client request received from ~p in "
           "state <~p>: ~p.", [GameId, From, StateName, Request]),
    {reply, {error, unexpected_request}, StateName, StateData}.
 
@@ -661,7 +661,7 @@ init_tour(Tour, #state{game_id = GameId, table_module = TableModule,
                       params = TableParams, players = Players, tables_num = TablesNum,
                       table_id_counter = TableIdCounter, tables = OldTables,
                       seats_per_table = SeatsPerTable} = StateData) ->
-    ?INFO("TRN_PAIRED <~p> Initializing tour <~p>...", [GameId, Tour]),
+    gas:info(?MODULE,"TRN_PAIRED <~p> Initializing tour <~p>...", [GameId, Tour]),
     PlayersList = prepare_players_for_new_tour(0, Players),
     {NewTables, Seats, NewTableIdCounter, CrRequests} =
         setup_tables(TableModule, PlayersList, SeatsPerTable, TablesNum, _TTable = undefined,
@@ -669,7 +669,7 @@ init_tour(Tour, #state{game_id = GameId, table_module = TableModule,
     if Tour > 1 -> finalize_tables_with_rejoin(TableModule, OldTables);
        true -> do_nothing
     end,
-    ?INFO("TRN_PAIRED <~p> Initializing of tour <~p> is finished. "
+    gas:info(?MODULE,"TRN_PAIRED <~p> Initializing of tour <~p> is finished. "
           "Waiting creating confirmations from the tours' tables...",
           [GameId, Tour]),
     {next_state, ?STATE_WAITING_FOR_TABLES, StateData#state{tables = NewTables,
@@ -684,14 +684,14 @@ init_tour(Tour, #state{game_id = GameId, table_module = TableModule,
                                                            }}.
 
 start_tour(#state{game_id = GameId, tour = Tour} = StateData) ->
-    ?INFO("TRN_PAIRED <~p> Starting tour <~p>...", [GameId, Tour]),
+    gas:info(?MODULE,"TRN_PAIRED <~p> Starting tour <~p>...", [GameId, Tour]),
     start_round(StateData#state{start_color = undefined}).
 
 start_round(#state{game_id = GameId, game_type = GameType, game_mode = GameMode,
                    mul_factor = MulFactor, quota_per_round = Amount,
                    tables = Tables, players = Players, table_module = TableModule,
                    start_color = StartColor} = StateData) ->
-    ?INFO("TRN_PAIRED <~p> Starting new round...", [GameId]),
+    gas:info(?MODULE,"TRN_PAIRED <~p> Starting new round...", [GameId]),
     UsersIds = [UserId || #player{user_id = UserId, is_bot = false} <- players_to_list(Players)],
     deduct_quota(GameId, GameType, GameMode, Amount, MulFactor, UsersIds),
     TablesList = tables_to_list(Tables),
@@ -701,7 +701,7 @@ start_round(#state{game_id = GameId, game_type = GameType, game_mode = GameMode,
         end,
     NewTables = lists:foldl(F, Tables, TablesList),
     WL = [T#table.id || T <- TablesList],
-    ?INFO("TRN_PAIRED <~p> The round is started. Processing...", [GameId]),
+    gas:info(?MODULE,"TRN_PAIRED <~p> The round is started. Processing...", [GameId]),
     NewStartColor =
         if StartColor == undefined ->
                {Die1, Die2} = competition_roll(),
@@ -716,7 +716,7 @@ start_round(#state{game_id = GameId, game_type = GameType, game_mode = GameMode,
                   || #table{pid = Pid} <- TablesList],
                OppColor
         end,
-    ?INFO("TRN_PAIRED <~p> Start color is ~p", [GameId, NewStartColor]),
+    gas:info(?MODULE,"TRN_PAIRED <~p> Start color is ~p", [GameId, NewStartColor]),
     {next_state, ?STATE_TOUR_PROCESSING, StateData#state{tables = NewTables,
                                                          tables_wl = WL,
                                                          start_color = NewStartColor,
@@ -724,9 +724,9 @@ start_round(#state{game_id = GameId, game_type = GameType, game_mode = GameMode,
                                                          next_turn_wl = WL}}.
 
 finalize_tour(#state{game_id = GameId} = StateData) ->
-    ?INFO("TRN_PAIRED <~p> Finalizing the tour...", [GameId]),
+    gas:info(?MODULE,"TRN_PAIRED <~p> Finalizing the tour...", [GameId]),
     {TRef, Magic} = start_timer(?SHOW_SERIES_RESULT_TIMEOUT),
-    ?INFO("TRN_PAIRED <~p> The tour is finalized. "
+    gas:info(?MODULE,"TRN_PAIRED <~p> The tour is finalized. "
           "Waiting some time (~p secs) before continue...",
           [GameId, ?SHOW_SERIES_RESULT_TIMEOUT div 1000]),
     {next_state, ?STATE_SHOW_TOUR_RESULT, StateData#state{timer = TRef, timer_magic = Magic}}.
@@ -734,9 +734,9 @@ finalize_tour(#state{game_id = GameId} = StateData) ->
 
 finalize_tournament(#state{game_id = GameId, table_module = TableModule,
                            tables = Tables} = StateData) ->
-    ?INFO("TRN_PAIRED <~p> Finalizing the tournament...", [GameId]),
+    gas:info(?MODULE,"TRN_PAIRED <~p> Finalizing the tournament...", [GameId]),
     finalize_tables_with_disconnect(TableModule, Tables),
-    ?INFO("TRN_PAIRED <~p> Finalization completed. Stopping...", [GameId]),
+    gas:info(?MODULE,"TRN_PAIRED <~p> Finalization completed. Stopping...", [GameId]),
     {stop, normal, StateData#state{tables = [], seats = []}}.
 
 
@@ -853,16 +853,16 @@ reg_player_with_replace(UserInfo, TableId, SeatNum, OldPlayerId, From, StateName
     NewPlayers = del_player(OldPlayerId, Players),
     NewPlayers2 = store_player(#player{id = PlayerId, user_id = UserId,
                                        user_info = UserInfo, is_bot = IsBot}, NewPlayers),
-    ?INFO("TRN_PAIRED <~p> User ~p registered as player <~p>.", [GameId, UserId, PlayerId]),
+    gas:info(?MODULE,"TRN_PAIRED <~p> User ~p registered as player <~p>.", [GameId, UserId, PlayerId]),
     NewSeats = set_seat(TableId, SeatNum, PlayerId, _Bot = false, _RegByTable = false,
                         _Connected = false, _Free = false, Seats),
-    ?INFO("TRN_PAIRED <~p> User ~p assigned to seat <~p> of table <~p>.", [GameId, UserId, SeatNum, TableId]),
+    gas:info(?MODULE,"TRN_PAIRED <~p> User ~p assigned to seat <~p> of table <~p>.", [GameId, UserId, SeatNum, TableId]),
     NewRegRequests = dict:store(PlayerId, From, RegRequests),
     #table{pid = TablePid, state = TableStateName} = fetch_table(TableId, Tables),
     NewTabRequests = table_req_replace_player(TableModule, TablePid, PlayerId, UserInfo, TableId, SeatNum, TabRequests),
     case TableStateName of
         ?TABLE_STATE_IN_PROGRESS when not IsBot->
-            ?INFO("TRN_PAIRED <~p> User ~p is a real player <~p> and he was registered in the middle of the round."
+            gas:info(?MODULE,"TRN_PAIRED <~p> User ~p is a real player <~p> and he was registered in the middle of the round."
                   "So deduct some quota.", [GameId, UserId, PlayerId]),
             deduct_quota(GameId, GameType, GameMode, Amount, MulFactor, [UserId]);
         _ -> do_nothing
@@ -895,11 +895,11 @@ reg_new_player(UserInfo, TableId, SeatNum, From, StateName,
                                    player_id_counter = PlayerId + 1},
     EnoughPlayers = enough_players(NewSeats, TablesNum*SeatsPerTable),
     if StateName == ?STATE_EMPTY_SEATS_FILLING andalso EnoughPlayers ->
-           ?INFO("TRN_PAIRED <~p> It's enough players registered to start the game. "
+           gas:info(?MODULE,"TRN_PAIRED <~p> It's enough players registered to start the game. "
                  "Initiating the procedure.", [GameId]),
            start_tour(NewStateData);
        true ->
-           ?INFO("TRN_PAIRED <~p> Not enough players registered to start the game. "
+           gas:info(?MODULE,"TRN_PAIRED <~p> Not enough players registered to start the game. "
                  "Waiting for more registrations.", [GameId]),
            {next_state, StateName, NewStateData}
     end.
@@ -1066,22 +1066,22 @@ remove_table_from_next_turn_wl(TableId, StateName,
                                #state{game_id = GameId, cur_color = CurColor,
                                       next_turn_wl = NextTurnWL, table_module = TableModule,
                                       tables = Tables, tables_wl = TablesWL} = StateData) ->
-    ?INFO("TRN_PAIRED <~p> Removing table <~p> from the next turn waiting list: ~p.",
+    gas:info(?MODULE,"TRN_PAIRED <~p> Removing table <~p> from the next turn waiting list: ~p.",
           [GameId, TableId, NextTurnWL]),
     NewNextTurnWL = lists:delete(TableId, NextTurnWL),
     if NewNextTurnWL == [] ->
            OppColor = opponent(CurColor),
            {Die1, Die2} = roll(),
-           ?INFO("TRN_PAIRED <~p> The next turn waiting list is empty. Rolling dice for color ~p: ~p",
+           gas:info(?MODULE,"TRN_PAIRED <~p> The next turn waiting list is empty. Rolling dice for color ~p: ~p",
                  [GameId, OppColor, [Die1, Die2]]),
            [send_to_table(TableModule, TablePid, {action, {rolls, OppColor, Die1, Die2}}) ||
               #table{pid = TablePid} <- tables_to_list(Tables)],
-           ?INFO("TRN_PAIRED <~p> New next turn waiting list is ~p",
+           gas:info(?MODULE,"TRN_PAIRED <~p> New next turn waiting list is ~p",
                  [GameId, TablesWL]),
            {next_state, StateName, StateData#state{next_turn_wl = TablesWL,
                                                    cur_color = OppColor}};
        true ->
-           ?INFO("TRN_PAIRED <~p> The next turn waiting list is not empty:~p. Waiting for the rest players.",
+           gas:info(?MODULE,"TRN_PAIRED <~p> The next turn waiting list is not empty:~p. Waiting for the rest players.",
                  [GameId, NewNextTurnWL]),
            {next_state, StateName, StateData#state{next_turn_wl = NewNextTurnWL}}
     end.
@@ -1235,7 +1235,7 @@ send_to_table(TableModule, TablePid, Message) ->
 
 
 get_param(ParamId, Params) ->
-    ?INFO("get_param/2 ParamId:~p", [ParamId]),
+    gas:info(?MODULE,"get_param/2 ParamId:~p", [ParamId]),
     {_, Value} = lists:keyfind(ParamId, 1, Params),
     Value.
 

+ 25 - 25
apps/server/src/tavla/test_tavla.erl

@@ -50,13 +50,13 @@ fire_starter(MultiOwner, CreateMode, RevealMode) ->
 
             Humans = [<<"maxim">>,<<"alice">>], % see authored users in auth_server.erl
             {ok, GameId, _A} = game_manager:create_table(game_tavla, [{deny_robots,true},{rounds, 1}], Humans),
-            ?INFO("created table for Tavla Game: gameid ~p",[{GameId,_A}]),
+            gas:info(?MODULE,"created table for Tavla Game: gameid ~p",[{GameId,_A}]),
             Clients = [ proc_lib:spawn_link(fun() -> 
                                  timer:sleep(crypto:rand_uniform(0, 10)),
                                  attach_and_join(Owner, Host, Port, GameId, Id, Rematch, RevealMode)
                         end) || Id <- Humans ],
 
-            ?INFO("Human Pids: ~p",[Clients]),
+            gas:info(?MODULE,"Human Pids: ~p",[Clients]),
             Orders = []
 
     end,
@@ -90,17 +90,17 @@ play_round(State0, Rematch) ->
 
 loop_and_restart(State) ->
     LoopRes = tavla_client_loop(State#state{}),
-    ?INFO("Human LoopRes: ~p",[LoopRes]),
+    gas:info(?MODULE,"Human LoopRes: ~p",[LoopRes]),
     say_ready(State),
     case LoopRes of
         <<"done">> ->
-            ?INFO("ID: ~p, next action done", [State#state.uid]),
+            gas:info(?MODULE,"ID: ~p, next action done", [State#state.uid]),
             ok;
         <<"next_set">> ->
-            ?INFO("ID: ~p, next action next_set", [State#state.uid]),
+            gas:info(?MODULE,"ID: ~p, next action next_set", [State#state.uid]),
             ok;
         <<"next_round">> ->
-            ?INFO("ID: ~p, next action next_round", [State#state.uid]),
+            gas:info(?MODULE,"ID: ~p, next action next_round", [State#state.uid]),
             State1 = State#state{current_round = -1},
             check_ack(State1, game_ended, fun loop_and_restart/1, [State1])
     end.
@@ -115,7 +115,7 @@ init_tavla_roundroll(State) ->
             log(game_info),
             State#state{mode = GT, current_round = CurrentRound, rounds = Rounds}
     after ?BT ->
-            ?INFO("ERROR: ~p", [{server_timeout, "game_event:tavla_game_info"}]),
+            gas:info(?MODULE,"ERROR: ~p", [{server_timeout, "game_event:tavla_game_info"}]),
             erlang:error({server_timeout, "game_event:tavla_game_info"})
     end.
 
@@ -146,7 +146,7 @@ tavla_client_loop(State) ->
             %okey_round_ended_checks(Args, State),
             Reason = proplists:get_value(reason, Args),
             NextAction = proplists:get_value(next_action, Args),
-            ?INFO("ID: ~p game ended, reason: ~p", [Id, Reason]),
+            gas:info(?MODULE,"ID: ~p game ended, reason: ~p", [Id, Reason]),
             NextAction;
         #player_left{} ->
             tavla_client_loop(State);
@@ -155,7 +155,7 @@ tavla_client_loop(State) ->
         #'game_event'{event = <<"player_left">>} ->
             tavla_client_loop(State);
         _Msg ->
-            ?INFO("the msg: ~p", [_Msg]),
+            gas:info(?MODULE,"the msg: ~p", [_Msg]),
             erlang:error({bot_received_unrecognized_message, _Msg})
     after ?BT ->
             log(server_timeouted),
@@ -176,7 +176,7 @@ do_roll(State) ->
                          game = GameId,
                          action = tavla_roll,
                          args = []}),
-    ?INFO("ID: ~p roll result: ~p", [State#state.uid, ZZZ]),
+    gas:info(?MODULE,"ID: ~p roll result: ~p", [State#state.uid, ZZZ]),
     ok.
 
 do_move(State) ->
@@ -188,7 +188,7 @@ do_move(State) ->
                          game = GameId,
                          action = tavla_move,
                          args = [ {moves, Moves}, {player, Player} ]}),
-    ?INFO("ID: ~p move result: ~p", [State#state.uid, ZZZ]),
+    gas:info(?MODULE,"ID: ~p move result: ~p", [State#state.uid, ZZZ]),
     ok.
 
 log(Msg) ->
@@ -197,14 +197,14 @@ log(Msg) ->
 wait_for(_C) ->
     receive
         {_, game_ended} ->
-            ?INFO("client: game ended");
+            gas:info(?MODULE,"client: game ended");
         {'EXIT', _, normal} = M ->
-            ?INFO("client: normal ending: ~p", [M]);
+            gas:info(?MODULE,"client: normal ending: ~p", [M]);
         {'EXIT', _C, Reason} = M ->
-            ?INFO("client: FAILURE message: ~p", [{M,_C,Reason}]),
+            gas:info(?MODULE,"client: FAILURE message: ~p", [{M,_C,Reason}]),
             erlang:error(Reason);
         M ->
-            ?INFO("client: unrecognized result: ~p", [M]),
+            gas:info(?MODULE,"client: unrecognized result: ~p", [M]),
             erlang:error(M)
     end.
 
@@ -220,7 +220,7 @@ check_ack(State = #state{acker_fun = F}, Event, ContinueFun, Args) ->
             apply(What, [State] ++ With),
             apply(ContinueFun, Args);
         stop ->
-            ?INFO("ID: ~p, Pid: ~p, check_ack. STOPPING THE BOT!!!", [State#state.uid, self()]),
+            gas:info(?MODULE,"ID: ~p, Pid: ~p, check_ack. STOPPING THE BOT!!!", [State#state.uid, self()]),
             erlang:error({terminate, acker_stop})
     end.
 
@@ -229,11 +229,11 @@ standard_acker(Owner) ->
     Ref = make_ref(),
     fun(Event) ->
             E = {event, Ref, Self, Event},
-            ?INFO("standard acker. ~p ! ~p", [Owner, E]),
+            gas:info(?MODULE,"standard acker. ~p ! ~p", [Owner, E]),
             Owner ! E,
             receive
                 {ARef, Res} when Ref == ARef ->
-                    ?INFO("standard acker got '~p' answer on question ~p", [Res,{Owner, E}]),
+                    gas:info(?MODULE,"standard acker got '~p' answer on question ~p", [Res,{Owner, E}]),
                     Res
             end
     end.
@@ -260,7 +260,7 @@ match_event(Orders, Events, Pid, Event) ->
     end.
 
 conductor(Orders, Clients) ->
-    ?INFO("conductor init", []),
+    gas:info(?MODULE,"conductor init", []),
     Pairs = lists:zip(lists:seq(1, length(Clients)), Clients),
     Orders2 = lists:map(fun(O) ->
                                 {_, P} = lists:keyfind(O#bo.pid, 1, Pairs),
@@ -268,7 +268,7 @@ conductor(Orders, Clients) ->
                         end, Orders),
     conductor(Orders2, Clients, []).
 conductor(_Orders, [], _Events) ->
-    ?INFO("conductor stop", []),
+    gas:info(?MODULE,"conductor stop", []),
     ok;
 conductor(Orders, Clients, Events) ->
     receive
@@ -283,18 +283,18 @@ conductor(Orders, Clients, Events) ->
             end,
             conductor(Orders, Clients, E2);
         {C, game_ended} ->
-            ?INFO("conductor: game ended", []),
+            gas:info(?MODULE,"conductor: game ended", []),
             conductor(Orders, lists:delete(C, Clients), Events);
         {'EXIT', C, normal} = M ->
-            ?INFO("conductor: normal ending: ~p", [M]),
+            gas:info(?MODULE,"conductor: normal ending: ~p", [M]),
             conductor(Orders, lists:delete(C, Clients), Events);
         {'EXIT', C, {terminate, acker_stop}} = M ->
-            ?INFO("conductor: removing client ~p because of ~p", [C, M]),
+            gas:info(?MODULE,"conductor: removing client ~p because of ~p", [C, M]),
             conductor(Orders, lists:delete(C, Clients), Events);
         {'EXIT', _C, Reason} = M ->
-            ?INFO("conductor: FAILURE message: ~p", [{M,_C,Reason}]),
+            gas:info(?MODULE,"conductor: FAILURE message: ~p", [{M,_C,Reason}]),
             erlang:error(Reason);
         M ->
-            ?INFO("conductor: unrecognized msg from client: ~p", [M]),
+            gas:info(?MODULE,"conductor: unrecognized msg from client: ~p", [M]),
             erlang:error(M)
     end.

+ 2 - 2
apps/server/src/tavla_sup.erl

@@ -12,7 +12,7 @@ start() -> supervisor:start({local, ?SERVER}, ?MODULE, []).
 start_link() -> supervisor:start_link({local, ?SERVER}, ?MODULE, []).
 stop() -> exit(?SERVER, shutdown).
 start_game(Mod,Par,GameId) -> 
-    ?INFO("TAVLA SUP STAR CHILD"),
+    gas:info(?MODULE,"TAVLA SUP STAR CHILD"),
 %%    Restart = transient,
     Restart = temporary,
     Shutdown = 200,
@@ -20,7 +20,7 @@ start_game(Mod,Par,GameId) ->
     supervisor:start_child(?MODULE,ChildSpec).
 
 init([]) ->
-    ?INFO("TAVLA SUP STARTED"),
+    gas:info(?MODULE,"TAVLA SUP STARTED"),
     RestartStrategy = one_for_one,
     MaxRestarts = 1,
     MaxSecondsBetweenRestarts = 600,

+ 0 - 214
apps/server/src/tests.erl

@@ -1,214 +0,0 @@
--module(tests).
-
--include_lib("eunit/include/eunit.hrl").
--include_lib("server/include/conf.hrl").
--include_lib("server/include/log.hrl").
--include_lib("server/include/kamf.hrl").
--include_lib("server/include/requests.hrl").
--include_lib("server/include/classes.hrl").
--include_lib("server/include/game_okey.hrl").
-
--export([setup/0, cleanup/1, tests_on/0]).
-
--define(BT, 3000000).
-
--define(SIM_TIMEOUT, 300).
-
-%% ===================================================================
-%% ===================================================================
-%% Tests
-%% ===================================================================
-%% ===================================================================
-
-stateful_test_() ->
-    {setup,
-     fun setup/0,
-     fun cleanup/1,
-     ?_test(
-        begin
-            send_receive_object_t(),
-            policy_file_plain_t(),
-            policy_file_t(),
-            policy_file_complex_t(),
-            async_server_rpc_test_t(),
-            encoding_client_failure_t(),
-            ok
-        end)
-    }.
-
-session_attach_test_() ->
-    {setup,
-     fun setup/0,
-     fun cleanup/1,
-     ?_test(
-        begin
-            session_attach_fail_t(),
-            session_attach_ok_t(),
-            ok
-        end)
-    }.
-
-message_read_write_test() ->
-    A = #game_event{event = <<"game_ended">>, game = 1, args = [{good_shot, true}, {awarded_points, 42}, {reason, <<"out_of_toshes">>}, {results, #'OkeyGameResults'{}}]},
-    {A, A} = {A, ?AMF:object_to_record(?AMF:record_to_object(A))}.
-
-setup() ->
-    ok = app_util:start(kakaconfig),
-    kakaconfig:temp_db(),
-    meck:new(kakaconfig, [passthrough]),
-    meck:expect(kakaconfig, get, fun
-                                     ([debug, is_test], _) -> {ok, true};
-                                     (okey_robot_delay, _) -> {ok, 1};
-                                     (Key, X) -> meck:passthrough([Key, X])
-                                 end),
-
-    meck:new(okey_stats, [passthrough]),
-    meck:expect(okey_stats, add_game, fun(R) -> ?INFO("saving game: ~p", [R]), {1, 1} end),
-    meck:expect(okey_stats, get_skill, fun(_) -> {ok, 500} end),
-    meck:expect(okey_stats, get_game_points, fun(_, _) -> {ok, [{game_points, 100},
-                                                                {finished_with_okey, 5},
-                                                                {finished_with_8_tashes, 1}]} end),
-    ok = app_util:start(kaka_id_generator),
-    ok = app_util:start(kaka_utils),
-    ok = app_util:start(kaka_auth_server),
-    ok = app_util:start(kaka_game_session),
-    ok = app_util:start(kaka_game_manager),
-    ok = app_util:start(kaka_matchmaking),
-    ok = app_util:start(kaka_conn).
-
-cleanup(_State) ->
-    application:stop(kaka_conn),
-    application:stop(kaka_matchmaking),
-    application:stop(kaka_game_manager),
-    application:stop(kaka_game_session),
-    application:stop(kaka_auth_server),
-    application:stop(kaka_utils),
-    application:stop(kaka_id_generator),
-    meck:unload(kakaconfig),
-    meck:unload(okey_stats),
-    db:stop(),
-    ok.
-
-tests_on() ->
-    meck:new(kakaconfig, [passthrough]),
-    meck:expect(kakaconfig, get, fun
-                                     ([debug, is_test], _) -> {ok, true};
-                                     (Key, X) -> meck:passthrough([Key, X])
-                                 end).
-
-session_attach_fail_t() ->
-    Token = "some fake token",
-    S1 = tc:connect(),
-    {error, <<"invalid_token">>} = tc:call_rpc(S1, #session_attach{token = Token}).
-
-session_attach_ok_t() ->
-    Token = "some proper token",
-    UserId = "mr_customer",
-    auth_server:store_token(Token, UserId),
-    S1 = tc:connect(),
-    Res = tc:call_rpc(S1, #session_attach{token = Token}),
-    #'PlayerInfo'{id = Id, login = Login} = Res,
-    true = is_binary(Login),
-    true = is_binary(Id),
-    tc:call_rpc(S1, #logout{}).
-
-encoding_client_failure_t() ->
-    Socket = tc:connect(),
-    Answer = tc:call_rpc_raw(Socket, 'getobjecttypefromserver_zzz', []),
-    ?INFO("encoding_client_failure_t: ~p", [Answer]),
-    {error, _Reason} = Answer.
-
-
-
-async_server_rpc_test_t() ->
-    TestClient = spawn_link(fun() -> tc:async_test_client_loop() end),
-    timer:sleep(100),
-    [{_, Pid, _, _}] = nsm_conn_app:get_clients(),
-
-    Self = self(),
-    Ref = make_ref(),
-    spawn(fun() ->
-                  Msg = #slowping{},
-                  <<"slowpong">> = conn_kamf_worker:send_request(Pid, Msg),
-                  Self ! Ref
-          end),
-
-    Message = #fastping{},
-    <<"fastpong">> = conn_kamf_worker:send_request(Pid, Message),
-    receive
-        Ref -> ok
-    after 5000 -> erlang:error(timeout) end,
-
-    TestClient ! exit.
-
-message_embedding_test() ->
-    A = {object,<<"KamfResponse">>,
-         [{id,1001},
-          {result,{object,
-                   <<"PlayerInfo">>,
-                   [{login,"oldman"},
-                    {name,"Ernest"},
-                    {surname,"Hemingway"}]}}]},
-    Bin = ?AMF:encode(A),
-    {A, _} = ?AMF:decode(Bin).
-
-kamf_conversion_test() ->
-    AR = {object,
-          <<"KamfRequest">>,
-          [{id,0},
-           {method,
-            <<"session_attach">>},
-           {args,
-            [{<<"token">>,
-              "EBAs6dg2Xw6XuCdg8qiPmlBLgYJ6N4Ti0P+oGpWgYz4NW4nBBUzTe/wAuLYtPnjFpsjCExxSpV78fipmsPxcf+NGy+QKIM6rmVJhpnIlKf0bpFNuGaAPjZAWthhGO8nZ0V8UnA=="}]}]},
-    BR = {object,
-          <<"KamfRequest">>,
-          [{id,0},
-           {method,
-            <<"session_attach">>},
-           {args,
-            [{<<"token">>,
-              <<"EBAs6dg2Xw6XuCdg8qiPmlBLgYJ6N4Ti0P+oGpWgYz4NW4nBBUzTe/wAuLYtPnjFpsjCExxSpV78fipmsPxcf+NGy+QKIM6rmVJhpnIlKf0bpFNuGaAPjZAWthhGO8nZ0V8UnA==">>}]}]},
-    kamf:object_to_record(AR),
-    kamf:object_to_record(BR),
-    ok.
-
-send_receive_object_t() ->
-    Socket = tc:connect(),
-    L = #'some_named_object'{name1 = <<"value1">>, name2 = 2, name3 = 3.0},
-    R = tc:call_rpc(Socket, #'getobjecttypefromserver'{}),
-    {L, L} = {L, R},
-    <<"Hello, guys! Have a nice day :)">> = tc:call_rpc(Socket, #'getstringtypefromserver'{}),
-    42 = tc:call_rpc(Socket, #'getintegertypefromserver'{}),
-    [_, {some_number, 42}, _, _] = tc:call_rpc(Socket, #'getmixedtypesfromserver'{}),
-    tc:close(Socket).
-
-policy_file_t() ->
-    {ok, Socket} = gen_tcp:connect(localhost, ?LISTEN_PORT, [{active, false}, binary, {packet, 0}]),
-    ok = gen_tcp:send(Socket, <<"<policy-file-request/>", 0>>),
-    {ok, Data} = gen_tcp:recv(Socket, 0),
-    Data = conn_kamf_worker:policy_file_text(),
-    ok = gen_tcp:send(Socket, <<?KAMF_MAGIC:48>>),
-    Sock = tc:connect(Socket),
-    #'some_named_object'{name1 = <<"value1">>, name2 = 2, name3 = 3.0} =
-        tc:call_rpc(Sock, #'getobjecttypefromserver'{}),
-    ok = tc:close(Sock).
-
-policy_file_complex_t() ->
-    {ok, Socket} = gen_tcp:connect(localhost, ?LISTEN_PORT, [{active, false}, binary, {packet, 0}]),
-    ok = gen_tcp:send(Socket, <<"<policy-file-request/>", 0, ?KAMF_MAGIC:48>>),
-    {ok, Data} = gen_tcp:recv(Socket, 0),
-    Data = conn_kamf_worker:policy_file_text(),
-    Sock = tc:connect(Socket),
-    #'some_named_object'{name1 = <<"value1">>, name2 = 2, name3 = 3.0} =
-        tc:call_rpc(Sock, #'getobjecttypefromserver'{}),
-    ok = tc:close(Sock).
-
-
-policy_file_plain_t() ->
-    {ok, Socket} = gen_tcp:connect(localhost, ?LISTEN_PORT, [{active, false}, binary, {packet, 0}]),
-    ok = gen_tcp:send(Socket, <<"<policy-file-request/>", 0>>),
-    {ok, Data} = gen_tcp:recv(Socket, 0),
-    Data = conn_kamf_worker:policy_file_text(),
-    ok = gen_tcp:close(Socket).
-

+ 0 - 1
apps/server/src/timestamp

@@ -1 +0,0 @@
-Fri Mar 22 02:34:07 EET 2013