A plugin that wraps every run with structured log output.
Configuration
# Default — logs at :info level, no model/tool/event logging
ADK.Plugin.register({ADK.Plugin.Logging, []})
# Debug level with event contents and model/tool logging
ADK.Plugin.register({ADK.Plugin.Logging,
level: :debug,
include_events: true,
log_model_calls: true,
log_tool_calls: true
})Options
:level— Logger level (:info|:debug|:warning). Default:info.:include_events— whether to log each event inon_event. Defaultfalse.:log_model_calls— whether to logbefore_model/after_model. Defaultfalse.:log_tool_calls— whether to logbefore_tool/after_tool. Defaultfalse.
Behaviour
before_run/2— logs run start with agent name and invocation ID; records start time.after_run/3— logs run end with event count, error count, and elapsed milliseconds.before_model/2— logs model call start (whenlog_model_calls: true).after_model/2— logs model call result (whenlog_model_calls: true).before_tool/3— logs tool call start (whenlog_tool_calls: true).after_tool/3— logs tool call result (whenlog_tool_calls: true).on_event/2— logs each event (wheninclude_events: true).
Implementation note
The per-model/tool/event hooks are stateless (no plugin state parameter). To bridge
the run-level configuration into these hooks, before_run/2 stores the relevant
settings in the process dictionary under {ADK.Plugin.Logging, :config}. This is
safe because all hooks within a single Runner.run/5 call execute in the same
process.