RuntimeCheck.Check (runtime_check v0.1.0)

View Source

Represents a system check.

  • name: The name of the check, an atom or string
  • checker: The function executed for the check, can be nil. It's as if the function returned :ok
  • nested_checks: A list of Check that are verified only if the checker returned :ok

Summary

Functions

Runs the given check(s). Logs the result of each check if log is true.

Types

checker()

@type checker() :: (-> :ok | {:ok, term()} | :ignore | {:error, term()})

name()

@type name() :: atom() | String.t()

t()

@type t() :: %RuntimeCheck.Check{
  checker: checker() | nil,
  depth: term(),
  log: term(),
  name: name(),
  nested_checks: [t()] | nil
}

Functions

run(check_or_checks, depth \\ 0, log \\ false)

@spec run(t() | [t()], non_neg_integer(), boolean()) ::
  {:ok, :ignored | %{required(name()) => term()}}
  | {:error, %{required(name()) => term()} | term()}

Runs the given check(s). Logs the result of each check if log is true.