Jido.Observe.Log (Jido v2.0.0-rc.1)
View SourceCentralized 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:
:debugin development for verbose output:infoor:warningin production for minimal noise
Configuration
# config/config.exs
config :jido, :observability,
log_level: :info
# config/dev.exs
config :jido, :observability,
log_level: :debugUsage
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
@type level() :: Logger.level()
Functions
@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")
@spec threshold() :: level()
Returns the current observability log threshold.
Reads from application config :jido, :observability, :log_level.
Defaults to :info if not configured.