loggy v0.1.1 Loggy.Format

Default formatting functions of loggy. They should take a string and return something printable. This can be a string, or a list, as is the case with IO.ANSI.format/2, used for colour in the default functions.

There should, generally, be no reason for you, the end user, to directly call these functions. Replacing them, however, might be in your interest. You'll do this by putting functions in the respective default options, or if you'd prefer, passing them manually with each call.

Examples

iex> Loggy.set_fn_params([
...>   debug: [format: fn str -> "[DEBG] " <> str end],
...>   info: [format: fn str -> "[INFO] " <> str end],
...>   warn: [format: fn str -> "[WARN] " <> str end],
...>   error: [format: fn str -> "[ERRO] " <> str end]
...> ])
iex> Loggy.info("Hello!")
#=> [INFO] Hello!
:ok

Link to this section Summary

Functions

Default formatting method for debug messages. To replace, write a function that takes and returns a string and assign fn_params[:debug][:format] to it

Default formatting method for debug strings. To replace, write a function that takes and returns a string and assign fn_params[:format][:error] to it

Default formatting method for info messages. To replace, write a function that takes and returns a printable item and assign fn_params[:format][:info] to it

Default formatting method for warning messages. To replace, write a function that takes and returns a string and assign fn_params[:format][:warn] to it

Link to this section Functions

Default formatting method for debug messages. To replace, write a function that takes and returns a string and assign fn_params[:debug][:format] to it.

Default formatting method for debug strings. To replace, write a function that takes and returns a string and assign fn_params[:format][:error] to it.

Default formatting method for info messages. To replace, write a function that takes and returns a printable item and assign fn_params[:format][:info] to it.

Default formatting method for warning messages. To replace, write a function that takes and returns a string and assign fn_params[:format][:warn] to it.