ggs_logger got lost somewhere? I added it again, also replaced all references to helpers with ggs_logger
This commit is contained in:
parent
ea1557e2d7
commit
94d9dc6d7f
5 changed files with 23 additions and 15 deletions
|
@ -17,32 +17,32 @@ start_link() ->
|
||||||
|
|
||||||
%% @doc Terminates the coordinator process.
|
%% @doc Terminates the coordinator process.
|
||||||
stop(_Reason) ->
|
stop(_Reason) ->
|
||||||
helpers:not_implemented().
|
ggs_logger:not_implemented().
|
||||||
|
|
||||||
%% @doc Joins table with specified token
|
%% @doc Joins table with specified token
|
||||||
join_table(_Token) ->
|
join_table(_Token) ->
|
||||||
helpers:not_implemented().
|
ggs_logger:not_implemented().
|
||||||
|
|
||||||
%% @doc Create a new table
|
%% @doc Create a new table
|
||||||
create_table(_Params) ->
|
create_table(_Params) ->
|
||||||
helpers:not_implemented().
|
ggs_logger:not_implemented().
|
||||||
|
|
||||||
%% @doc This is the first function run by a newly created players.
|
%% @doc This is the first function run by a newly created players.
|
||||||
%% Generates a unique token that we use to identify the player.
|
%% Generates a unique token that we use to identify the player.
|
||||||
join_lobby() ->
|
join_lobby() ->
|
||||||
helpers:not_implemented().
|
ggs_logger:not_implemented().
|
||||||
|
|
||||||
%% @doc Act as a supervisor to player and respawns player when it gets bad data.
|
%% @doc Act as a supervisor to player and respawns player when it gets bad data.
|
||||||
respawn_player(_Player, _Socket) ->
|
respawn_player(_Player, _Socket) ->
|
||||||
helpers:not_implemented().
|
ggs_logger:not_implemented().
|
||||||
|
|
||||||
%% @doc Act as a supervisor to table and respawns table when it gets bad data.
|
%% @doc Act as a supervisor to table and respawns table when it gets bad data.
|
||||||
respawn_table(_Token) ->
|
respawn_table(_Token) ->
|
||||||
helpers:not_implemented().
|
ggs_logger:not_implemented().
|
||||||
|
|
||||||
%% @doc Removes a player from coordinator.
|
%% @doc Removes a player from coordinator.
|
||||||
remove_player(_From, _Player) ->
|
remove_player(_From, _Player) ->
|
||||||
helpers:not_implemented().
|
ggs_logger:not_implemented().
|
||||||
|
|
||||||
%% gen_server callbacks
|
%% gen_server callbacks
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ start_link(Port) ->
|
||||||
%% @doc Stops the dispatcher with the specified reason.
|
%% @doc Stops the dispatcher with the specified reason.
|
||||||
%% @spec stop(Reason) -> ok.
|
%% @spec stop(Reason) -> ok.
|
||||||
%% Reason = String
|
%% Reason = String
|
||||||
stop(_Reason) -> helpers:not_implemented().
|
stop(_Reason) -> ggs_logger:not_implemented().
|
||||||
|
|
||||||
%% gen_server callbacks
|
%% gen_server callbacks
|
||||||
|
|
||||||
|
|
8
src/ggs_logger.erl
Normal file
8
src/ggs_logger.erl
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
-module(ggs_logger).
|
||||||
|
-export([not_implemented/0, log/2]).
|
||||||
|
|
||||||
|
not_implemented() ->
|
||||||
|
exit(not_implemented).
|
||||||
|
|
||||||
|
log(Format, Args) ->
|
||||||
|
error_logger:info_msg(Format, Args).
|
|
@ -20,19 +20,19 @@ start_link(Socket) ->
|
||||||
%% @spec notify(Player::Pid(), From::Pid(),
|
%% @spec notify(Player::Pid(), From::Pid(),
|
||||||
%% {Command::String(), Message::string()}) -> ok
|
%% {Command::String(), Message::string()}) -> ok
|
||||||
notify(Player, From, Message) ->
|
notify(Player, From, Message) ->
|
||||||
helpers:not_implemented().
|
ggs_logger:not_implemented().
|
||||||
|
|
||||||
%% @doc Get the player token uniquely representing the player.
|
%% @doc Get the player token uniquely representing the player.
|
||||||
%% @spec get_token() -> string()
|
%% @spec get_token() -> string()
|
||||||
get_token(_Player) ->
|
get_token(_Player) ->
|
||||||
helpers:not_implemented().
|
ggs_logger:not_implemented().
|
||||||
|
|
||||||
%% @doc Properly terminates the player process. The player token will be lost
|
%% @doc Properly terminates the player process. The player token will be lost
|
||||||
%% together with the table token. It should also close the player socket and the
|
%% together with the table token. It should also close the player socket and the
|
||||||
%% process should return in the end.
|
%% process should return in the end.
|
||||||
%% @spec stop(Table::pid()) -> Reason::string()
|
%% @spec stop(Table::pid()) -> Reason::string()
|
||||||
stop(_Player,_Table) ->
|
stop(_Player,_Table) ->
|
||||||
helpers:not_implemented().
|
ggs_logger:not_implemented().
|
||||||
|
|
||||||
%% Internals
|
%% Internals
|
||||||
|
|
||||||
|
|
|
@ -4,20 +4,20 @@
|
||||||
%% @doc start_link should always return ok for any valid socket. A valid socket
|
%% @doc start_link should always return ok for any valid socket. A valid socket
|
||||||
%% should always return {ok, Pid} and {error, Reason} otherwise.
|
%% should always return {ok, Pid} and {error, Reason} otherwise.
|
||||||
start_link_test() ->
|
start_link_test() ->
|
||||||
helpers:not_implemented().
|
ggs_logger:not_implemented().
|
||||||
|
|
||||||
%% @doc Given that start_link returned {ok, Player}. Notify shall always return ok and
|
%% @doc Given that start_link returned {ok, Player}. Notify shall always return ok and
|
||||||
%% deliver a specified message through the socket.
|
%% deliver a specified message through the socket.
|
||||||
notify_test() ->
|
notify_test() ->
|
||||||
helpers:not_implemented().
|
ggs_logger:not_implemented().
|
||||||
|
|
||||||
%% @doc Given that start_link returned {ok, Player}. get_token shall always return a valid
|
%% @doc Given that start_link returned {ok, Player}. get_token shall always return a valid
|
||||||
%% player token. a valid token should be unique.
|
%% player token. a valid token should be unique.
|
||||||
get_token_test() ->
|
get_token_test() ->
|
||||||
helpers:not_implemented().
|
ggs_logger:not_implemented().
|
||||||
|
|
||||||
%% @doc Given that start_link returned {ok, Pid}. There shouldn't be possible to
|
%% @doc Given that start_link returned {ok, Pid}. There shouldn't be possible to
|
||||||
%% execute this function with the same Player and Table arguments twice.
|
%% execute this function with the same Player and Table arguments twice.
|
||||||
stop_test() ->
|
stop_test() ->
|
||||||
helpers:not_implemented().
|
ggs_logger:not_implemented().
|
||||||
|
|
||||||
|
|
Reference in a new issue