plexy v0.3.3 Plexy.Logger

Plexy.Logger is a proxy to Elixir's built-in logger that knows how to handle non char-data and has a few other helpful logging functions.

Link to this section Summary

Functions

Logs a info message with the given metric as a count

Logs a debug message

Logs a error message

Logs a info message

Log using the given level and data. This function should be avoided in favor of .info, .warn, .debug, .error, because they are removed at compile time

Logs a info message the amount of time in milliseconds required to run the given function and tags it as metric

Logs a warn message

Link to this section Functions

Link to this function

count(metric, count \\ 1)

Logs a info message with the given metric as a count

Examples

Plexy.Logger.count(:signup, 2)
Plexy.Logger.count("registration", 1)
Plexy.Logger.count("registration") # same as above
Link to this function

debug(datum_or_fn, metadata \\ [])

Logs a debug message.

Returns the atom :ok or an {:error, reason}

Examples

Plexy.Logger.debug "hello?"
Plexy.Logger.debug [color: "purple"]
Plexy.Logger.debug %{sky: "blue"}
Plexy.Logger.debug fn -> hard_work_goes_here end
Link to this function

error(datum_or_fn, metadata \\ [])

Logs a error message.

Returns the atom :ok or an {:error, reason}

Examples

Plexy.Logger.error "hello?"
Plexy.Logger.error [color: "purple"]
Plexy.Logger.error %{sky: "blue"}
Plexy.Logger.error fn -> hard_work_goes_here end
Link to this function

info(datum_or_fn, metadata \\ [])

Logs a info message.

Returns the atom :ok or an {:error, reason}

Examples

Plexy.Logger.info "hello?"
Plexy.Logger.info [color: "purple"]
Plexy.Logger.info %{sky: "blue"}
Plexy.Logger.info fn -> hard_work_goes_here end
Link to this function

log(level, datum_or_fn, metadata \\ [])

Log using the given level and data. This function should be avoided in favor of .info, .warn, .debug, .error, because they are removed at compile time.

Link to this function

measure(metric, time)

Logs a info message the amount of time in milliseconds required to run the given function and tags it as metric.

Examples

Plexy.Logger.measure(:call_core, &super_slow_call/0)
Plexy.Logger.measure("rebuild", fn -> rebuild_the_invoice end)
Link to this function

warn(datum_or_fn, metadata \\ [])

Logs a warn message.

Returns the atom :ok or an {:error, reason}

Examples

Plexy.Logger.warn "hello?"
Plexy.Logger.warn [color: "purple"]
Plexy.Logger.warn %{sky: "blue"}
Plexy.Logger.warn fn -> hard_work_goes_here end