View Source Untangle (untangle v0.3.0)

Logging and debug printing that include location information

Link to this section Summary

Functions

Custom backend for Kernel.dbg/2. This function provides a backend for Kernel.dbg/2. This function

Like dump, but for logging at debug level

IO.inspect but outputs to Logger with position information, an optional label and configured not to truncate output too much.

Similar to dump, but for logging at error level, and returns an error tuple

Like dump, but for logging at info level

Like debug, but will do nothing unless the :debug option is truthy

Like maybe_dbg, but requires the :verbose option to be set. Intended for large outputs.

Tries to 'do what i mean'. Requires the debug option to be set regardless. If verbose is also set, will inspect else will attempt to print some (hopefully smaller) type-dependent summary of the data (list length, map keys).

Like dump, but for logging at warn level

Link to this section Functions

Link to this function

custom_dbg(code, options, env)

View Source

Custom backend for Kernel.dbg/2. This function provides a backend for Kernel.dbg/2. This function:

  • may log or print information about the given env
  • may log or print information about code and its returned value (using opts to inspect terms)
  • returns the value returned by evaluating code
Link to this macro

debug(thing, label \\ "")

View Source (macro)

Like dump, but for logging at debug level

Link to this macro

dump(thing, label \\ "")

View Source (macro)

IO.inspect but outputs to Logger with position information, an optional label and configured not to truncate output too much.

Link to this macro

error(thing, label \\ "")

View Source (macro)

Similar to dump, but for logging at error level, and returns an error tuple:

  • an error tuple with the label, if any
  • an error tuple with the passed value otherwise

iex> error(:value)

[error] :value

iex> error({:error, :value})

[error] :value

iex> error(:value, "with label")

[error] with label: :value

iex> error({:error, :value}, "with label")

[error] with label: :value

Link to this function

format_stacktrace_sliced(stacktrace, starts \\ 1, ends \\ 5)

View Source
Link to this macro

info(thing, label \\ "")

View Source (macro)

Like dump, but for logging at info level

Link to this macro

maybe_dbg(thing, label \\ "", options)

View Source (macro)

Like debug, but will do nothing unless the :debug option is truthy

Link to this macro

maybe_info(thing, label \\ "", options)

View Source (macro)

Like maybe_dbg, but requires the :verbose option to be set. Intended for large outputs.

Link to this macro

smart(thing, label \\ "", options)

View Source (macro)

Tries to 'do what i mean'. Requires the debug option to be set regardless. If verbose is also set, will inspect else will attempt to print some (hopefully smaller) type-dependent summary of the data (list length, map keys).

Link to this macro

warn(thing, label \\ "")

View Source (macro)

Like dump, but for logging at warn level