Created
September 26, 2014 14:33
-
-
Save jfreeze/7472e0f0ccc40e8314c4 to your computer and use it in GitHub Desktop.
Distro.DistroCalc logging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Distro.DistroCalc do | |
use GenServer | |
require Logger | |
def start_link do | |
GenServer.start_link(__MODULE__, [], name: {:global, __MODULE__}) | |
end | |
def add(x,y) do | |
Logger.info "self: #{inspect Node.self}" | |
GenServer.call({:global, __MODULE__}, {:cal, x, y}) | |
end | |
def handle_call({:cal, x, y}, _from, state) do | |
Logger.info "self: #{inspect self}, Node.self: #{inspect Node.self}, from: #{inspect _from}, state: #{inspect state}" | |
{ :reply, x + y, state } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment