View Source ExDebug (ExDebug v1.0.0)

Debugging functions for making life easier.

Summary

Functions

Prints the input argument in console within a formatted frame.

Functions

Link to this function

console(input, opt \\ [])

View Source
@spec console(input :: any(), opt :: keyword()) :: any()

Prints the input argument in console within a formatted frame.

The function will always return the input argument as a passthrough. the given input term will only be printed in the console in :dev and :test environments, in any other environment (such as :prod), there will be no printing.

It can recieve a keyword list as options.

Options

  • label: A string to print on the header for identification purposes.

  • color: Color of the label if its given. Values between 0-255.

  • width: Lenght of characters to be used in the console print.

  • line_color: Color of the header and footer lines. Values between 0-255.

  • time_color: Color of the execution time. Values between 0-255.

  • syntax_colors: Keyword list for term syntax color.

    Keys: :atom, :binary, :boolean, :list, :map, :nil, :number, :regex, :reset, :string, :tuple.

    Values: :black, :red, :yellow, :green, :cyan, :blue, :magenta, :white, :light_black, :light_red, :light_yellow, :light_green, :light_cyan, :light_blue, :light_magenta, :light_white.

256 color palette

palette image

Example

iex> "Lorem-Ipsum"
...> |> String.split("-")
...> |> ExDebug.console(label: "Split return")
...> |> Enum.join()
...> |> String.downcase()
# Split return -------------------------------------- 2022-03-10 - 00:47:07.523741
# ["Lorem", "Ipsum"]
# ------------------------------------------------------------------- MyApp v0.0.0
"loremipsum" # <- This is the actual pipeline return, besides de console print.