Toolshed.Log (toolshed v0.2.21) View Source

Utilities for attaching and detaching to the log

These utilities configure Elixir's console backend to attach to the current group leader. This makes it work over ssh sessions and play well with the IEx prompt.

Link to this section Summary

Functions

Attach the current session to the Elixir logger

Detach the current session from the Elixir logger

Link to this section Functions

Link to this function

log_attach(options \\ [])

View Source

Specs

log_attach(keyword()) :: {:error, any()} | {:ok, :undefined | pid()}

Attach the current session to the Elixir logger

This forwards incoming log messages to the terminal. Call detach/0 to stop the messages.

Behind the scenes, this uses Elixir's built-in console logger and can be configured similarly. See the Logger console backend documentation for details. The following are useful options:

  • :level - the minimum log level to report. E.g., specify level: :warning to only see warnings and errors.
  • :metadata - a list of metadata keys to show or :all

Unspecified options use either the console backend's default or those found in the application environment for the :console Logger backend.

Specs

log_detach() :: :ok | {:error, :not_attached | :not_found}

Detach the current session from the Elixir logger