PassiveSupport.Logging (passive_support v0.8.1)

Helper functions for logging and inspecting.

These functions serve two primary purposes:

  1. To keep outputs colorized even when they're sent to Logger,
  2. To keep IO.inspect and Kernel.inspect from truncating away data you might need if you intend, e.g., to save a function's return as fixture data for debugging purposes

Link to this section Summary

Functions

Pretty good, pretty pretty, color choices for inspected data

Sensible defaults for IO.inspect and Kernel.inspect when you want to see a value in its entirety

Sensible option defaults for logging information to stdout

Link to this section Functions

Link to this function

alert(item \\ nil, label \\ nil)

Link to this function

coloration_opts()

Specs

coloration_opts() ::
  {:syntax_colors,
   [
     number: :yellow,
     string: :green,
     list: :light_magenta,
     map: :light_cyan,
     atom: :light_blue,
     tuple: :"[:black_background, :white]",
     regex: :"[:cyan_background, :light_yellow]"
   ]}

Pretty good, pretty pretty, color choices for inspected data

Link to this function

critical(item \\ nil, label \\ nil)

Link to this function

debug(item \\ nil, label \\ nil)

Link to this function

emergency(item \\ nil, label \\ nil)

Link to this function

error(item \\ nil, label \\ nil)

Link to this function

info(item \\ nil, label \\ nil)

Link to this function

inspect(item, to_log \\ false)

calls Kernel.inspect/2 on item with logger_opts/0.

If you wish to overwrite some portion of the opts send to inspect, consider calling Kernel.inspect and passing Utils.logger_opts() ++ overwrites as your opts instead of calling this function.

Specs

inspect_opts() :: [
  printable_limit: :infinity,
  limit: :infinity,
  width: 170,
  pretty: true
]

Sensible defaults for IO.inspect and Kernel.inspect when you want to see a value in its entirety

Specs

logger_opts() :: [
  syntax_colors: [
    number: :yellow,
    string: :green,
    list: :light_magenta,
    map: :light_cyan,
    atom: :light_blue,
    tuple: :"[:black_background, :white]",
    regex: :"[:cyan_background, :light_yellow]"
  ],
  printable_limit: :infinity,
  limit: :infinity,
  width: 170,
  pretty: true
]

Sensible option defaults for logging information to stdout

Link to this function

notice(item \\ nil, label \\ nil)

Link to this function

warn(item \\ nil, label \\ nil)