Jido.Observe.Log (Jido v2.0.0-rc.1)

View Source

Centralized log threshold for observability.

This module provides threshold-based logging for Jido's observability system. The log threshold can be configured per-environment to control verbosity:

  • :debug in development for verbose output
  • :info or :warning in production for minimal noise

Configuration

# config/config.exs
config :jido, :observability,
  log_level: :info

# config/dev.exs
config :jido, :observability,
  log_level: :debug

Usage

alias Jido.Observe.Log

# Only logs if threshold allows :debug level
Log.log(:debug, "Processing step", agent_id: agent.id, step: 1)

# Always logs in most configurations
Log.log(:info, "Agent completed", agent_id: agent.id)

Summary

Functions

Conditionally logs a message based on the observability threshold.

Returns the current observability log threshold.

Types

level()

@type level() :: Logger.level()

Functions

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

@spec log(level(), Logger.message(), keyword()) :: :ok

Conditionally logs a message based on the observability threshold.

The message is logged only if the threshold level allows it. Uses Jido.Util.cond_log/4 under the hood.

Parameters

  • level - The log level for this message (:debug, :info, :warning, :error)
  • message - The message to log (string or iodata)
  • metadata - Keyword list of metadata to include

Examples

# With threshold at :info, this won't log
Log.log(:debug, "Verbose info", step: 1)

# With threshold at :info, this will log
Log.log(:info, "Important info", agent_id: "abc")

threshold()

@spec threshold() :: level()

Returns the current observability log threshold.

Reads from application config :jido, :observability, :log_level. Defaults to :info if not configured.