From 94d9dc6d7f546b0e4613bb66510488f181934bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20P=C3=A5lsson?= Date: Thu, 17 Feb 2011 08:33:55 +0100 Subject: [PATCH] ggs_logger got lost somewhere? I added it again, also replaced all references to helpers with ggs_logger --- src/ggs_coordinator.erl | 14 +++++++------- src/ggs_dispatcher.erl | 2 +- src/ggs_logger.erl | 8 ++++++++ src/ggs_player.erl | 6 +++--- tests/ggs_player_test.erl | 8 ++++---- 5 files changed, 23 insertions(+), 15 deletions(-) create mode 100644 src/ggs_logger.erl diff --git a/src/ggs_coordinator.erl b/src/ggs_coordinator.erl index 2a755f0..4e6b623 100644 --- a/src/ggs_coordinator.erl +++ b/src/ggs_coordinator.erl @@ -17,32 +17,32 @@ start_link() -> %% @doc Terminates the coordinator process. stop(_Reason) -> - helpers:not_implemented(). + ggs_logger:not_implemented(). %% @doc Joins table with specified token join_table(_Token) -> - helpers:not_implemented(). + ggs_logger:not_implemented(). %% @doc Create a new table create_table(_Params) -> - helpers:not_implemented(). + ggs_logger:not_implemented(). %% @doc This is the first function run by a newly created players. %% Generates a unique token that we use to identify the player. join_lobby() -> - helpers:not_implemented(). + ggs_logger:not_implemented(). %% @doc Act as a supervisor to player and respawns player when it gets bad data. 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. respawn_table(_Token) -> - helpers:not_implemented(). + ggs_logger:not_implemented(). %% @doc Removes a player from coordinator. remove_player(_From, _Player) -> - helpers:not_implemented(). + ggs_logger:not_implemented(). %% gen_server callbacks diff --git a/src/ggs_dispatcher.erl b/src/ggs_dispatcher.erl index 4e353da..49dcf4b 100644 --- a/src/ggs_dispatcher.erl +++ b/src/ggs_dispatcher.erl @@ -29,7 +29,7 @@ start_link(Port) -> %% @doc Stops the dispatcher with the specified reason. %% @spec stop(Reason) -> ok. %% Reason = String -stop(_Reason) -> helpers:not_implemented(). +stop(_Reason) -> ggs_logger:not_implemented(). %% gen_server callbacks diff --git a/src/ggs_logger.erl b/src/ggs_logger.erl new file mode 100644 index 0000000..49f5abc --- /dev/null +++ b/src/ggs_logger.erl @@ -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). diff --git a/src/ggs_player.erl b/src/ggs_player.erl index c3695af..37c8496 100644 --- a/src/ggs_player.erl +++ b/src/ggs_player.erl @@ -20,19 +20,19 @@ start_link(Socket) -> %% @spec notify(Player::Pid(), From::Pid(), %% {Command::String(), Message::string()}) -> ok notify(Player, From, Message) -> - helpers:not_implemented(). + ggs_logger:not_implemented(). %% @doc Get the player token uniquely representing the player. %% @spec get_token() -> string() get_token(_Player) -> - helpers:not_implemented(). + ggs_logger:not_implemented(). %% @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 %% process should return in the end. %% @spec stop(Table::pid()) -> Reason::string() stop(_Player,_Table) -> - helpers:not_implemented(). + ggs_logger:not_implemented(). %% Internals diff --git a/tests/ggs_player_test.erl b/tests/ggs_player_test.erl index fc13eb5..1067f71 100644 --- a/tests/ggs_player_test.erl +++ b/tests/ggs_player_test.erl @@ -4,20 +4,20 @@ %% @doc start_link should always return ok for any valid socket. A valid socket %% should always return {ok, Pid} and {error, Reason} otherwise. start_link_test() -> - helpers:not_implemented(). + ggs_logger:not_implemented(). %% @doc Given that start_link returned {ok, Player}. Notify shall always return ok and %% deliver a specified message through the socket. notify_test() -> - helpers:not_implemented(). + ggs_logger:not_implemented(). %% @doc Given that start_link returned {ok, Player}. get_token shall always return a valid %% player token. a valid token should be unique. get_token_test() -> - helpers:not_implemented(). + ggs_logger:not_implemented(). %% @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. stop_test() -> - helpers:not_implemented(). + ggs_logger:not_implemented().