Skip to content

Instantly share code, notes, and snippets.

@elbrujohalcon
Created September 26, 2017 02:17
Show Gist options
  • Save elbrujohalcon/95393daa3496433942fec01e964210c5 to your computer and use it in GitHub Desktop.
Save elbrujohalcon/95393daa3496433942fec01e964210c5 to your computer and use it in GitHub Desktop.
Maybe Server v2
-module(maybe_server).
-behaviour(gen_server).
-export([start_link/0, stop/0]).
-export([init/1, terminate/2, handle_call/3, handle_cast/2]).
%% EXTERNAL API ------------------------------------------------------------------------------------
start_link() -> gen_server:start_link({local, ?MODULE}, ?MODULE, #{}, [{debug, [log, trace]}]).
stop() -> gen_server:stop(?MODULE).
%% CALLBACKS ---------------------------------------------------------------------------------------
init(#{}) ->
error_logger:info_msg("Server ~p starting.~n", [self()]),
{ok, #{}}.
terminate(Reason, _State) ->
error_logger:info_msg("Server ~p terminating with reason ~p~n", [self(), Reason]).
%% UNUSED CALLBACKS --------------------------------------------------------------------------------
handle_call(_Msg, _From, State) -> {noreply, State}.
handle_cast(_Msg, State) -> {noreply, State}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment