Ankusa.LogLevel (ankusa v0.7.0)

Copy Markdown View Source

The VM's Logger level, changed while the node runs.

set/1 is what PUT /v1/log-level (Ankusa.Admin.Router, scope config:write) calls, and what ankusa_server calls at boot with log.level: one place decides which levels exist. The change is global and immediate (Logger.configure/1 moves the primary level), needs no restart and is not persisted: a restarted node logs at the level its config file names.

Only debug, info, warning and error are accepted, the same set log.level takes.

Summary

Types

A level this module accepts.

Functions

The level now in force.

Every accepted level, most verbose first.

Read level (an atom, or its name as a string) as an accepted level.

Make level the VM's log level. Returns the level that was in force, so the caller can report (and audit) the change.

Types

level()

@type level() :: :debug | :info | :warning | :error

A level this module accepts.

Functions

get()

@spec get() :: Logger.level()

The level now in force.

levels()

@spec levels() :: [level()]

Every accepted level, most verbose first.

parse(level)

@spec parse(term()) :: {:ok, level()} | :error

Read level (an atom, or its name as a string) as an accepted level.

set(level)

@spec set(term()) :: {:ok, previous :: Logger.level()} | {:error, :invalid_level}

Make level the VM's log level. Returns the level that was in force, so the caller can report (and audit) the change.