Óg Build StatusHex VersionHex docs

Óg is a small collection of debugging functions for use during development.

Note

Installation

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

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

Ensure that :logger is started in the applications:

def application do [applications: [:logger]] end

Summary

use Mix.Config

config :logger,
  backends: [:console],
  level: :debug,
  compile_time_purge_level: :debug,
  compile_time_application: :my_app,
  truncate: (4096 * 8),
  utc_log: :false

config :logger, :console,
  level: :debug,
  format: "$time $metadata [$level] $message\n",
  metadata: []

config :logger, :og,
  kernel_opts: [width: 70],
  apex_opts: [numbers: :false, color: :false]

some examples

Og.log(:test)
Og.log(:test, level: :warn)
Og.log(:test, level: :warn, env: __ENV__)
````

- Logging with the Apex inspector

Og.log(:test, inspector: :apex)


- Logging inside a chain of piped functions

defmodule OgTest do def log() do

%{first: "john", last: "doe"}
|> Map.to_list()
|> Enum.filter( &(&1 === {:first, "john"}))
|> Og.log_r()
|> List.last()
|> Tuple.to_list()
|> List.last()
|> Og.log_r(env: __ENV__, inspector: :kernel, level: :info)
|> String.upcase()

end end OgTest.log()




### Acknowledgements

- Credit to [Björn Rochel](https://github.com/BjRo) for the [Apex library](https://github.com/BjRo/apex).
Setting opts to `[inspector: :apex]` will use the `Apex.Format.format/2` function from the apex library.

### Todo

- [ ] Investigate adding a custom formatting module as an optional additional means of logging.

### Licence

MIT