Skip to content

Instantly share code, notes, and snippets.

@jasongoodwin
Last active December 29, 2017 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasongoodwin/45be39b6e1f817ee3063a8bf20856d7c to your computer and use it in GitHub Desktop.
Save jasongoodwin/45be39b6e1f817ee3063a8bf20856d7c to your computer and use it in GitHub Desktop.
defmodule LoggingFake do
@moduledoc """
This server is a Fake.
It will log the messages received.
Helpful stub of a genserver.
"""
use GenServer
require Logger
def handle_call(msg, _from, state) do
Logger.info("fake metrics: Received #{inspect msg}")
{:reply, state, state}
end
def handle_cast(msg, state) do
Logger.info("fake metrics: Received #{inspect msg}")
{:noreply, state}
end
def start_link(_) do
GenServer.start_link(__MODULE__, [], name: __MODULE__)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment