I’m working on my first Elixir project. I’m doing the Github issues project following the instruction in Dave Thomas’s Programming Elixir book.
I have this in my github_issues.ex file:
defmodule Issues.GithubIssues do
require Logger
@user_agent [{"User-agent",
"crisefd"}]
@github_url Application.get_env(:issues, :github_url)
def fetch(user, project) do
Logguer.info("Fetching #{user}'s project #{project}'")
issues_url(user, project)
|> HTTPoison.get(@user_agent)
|> handle_response
end
defp issues_url(user, project) do
"#{@github_url}/repos/#{user}/#{project}/issues"
end
defp handle_response({_, %{status_code: status_code, body: body}}) do
Logger.info("Got response: status code=#{status_code}")
Logger.debug(fn -> inspect(body) end)
{
status_code |> check_for_errors(),
body |> Poison.Parser.parse!()
}
end
defp check_for_errors(200), do: :ok
defp check_for_errors(_), do: :error
end
But I’m getting this error when running the app with iex -S mix:
iex(1)> Issues.CLI.process {"myuser", "myproject", 4}
** (UndefinedFunctionError) function Logguer.info/1 is undefined (module Logguer is not available)
Logguer.info("Fetching crisefd's project angular'")
(issues) lib/issues/github_issues.ex:10: Issues.GithubIssues.fetch/2
(issues) lib/issues/cli.ex:38: Issues.CLI.process/1
This is my config.ex:
use Mix.Config
config :issues, github_url: "https://api.github.com"
config :logger, compile_time_purge_level: :debug