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
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
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
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
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
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.
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)
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