Óg Build StatusHex VersionHex docs

Óg is a small collection of logger helper functions.

Installation

Add óg to your list of dependencies in mix.exs:

def deps, do: [{:og, "~> 0.1.0"}]

Summary

log/1, log/2, log/3, log/4

log_return/1, log_return/2, log_return/3, log_return/4

context/1, context/2, context/3

conn_context/2, conn_context/3, conn_context/4, conn_context/5

Example Usages

Og.log/1

Og.log(String.to_atom("test"))

Og.log/3

Og.log(String.to_atom("test"), __ENV__, :warn)

Og.log_return/3

%{first: "john", last: "doe"}
|> Map.to_list()
|> Enum.filter( &(&1 === {:first, "john"}))
|> Og.log_return()
|> List.last()
|> Tuple.to_list()
|> List.last()
|> Og.log_return(:warn)
|> String.upcase()

Og.context/3

defmodule Test do
def env_test() do
Og.context(__ENV__, :info)
end
end
Test.env_test()

Og.conn_context/3

defmodule Test do
use Plug.Test
def test() do
conn = Plug.Test.conn(:get, "/test", :nil)
Og.conn_context(conn, __ENV__, :debug)
end
end
Test.test()

Licence

MIT