Hermes.Logging (hermes_mcp v0.9.1)

Centralized logging for Hermes MCP client.

This module provides structured logging functions that automatically manage context and format logs appropriately based on log levels.

Configuration

You can configure logging levels for different event types:

config :hermes_mcp, :logging,
  client_events: :info,     # client lifecycle events
  server_events: :info,     # server lifecycle events
  transport_events: :debug, # transport layer events
  protocol_messages: :debug # MCP protocol messages

Alternatively, you can disable Hermes logging entirely:

config :hermes_mcp, :log, false

Summary

Functions

Log client events with structured format.

Log protocol messages with automatic formatting and context.

Log server events with structured format.

Log transport events with structured format.

Functions

client_event(event, details, metadata \\ [])

Log client events with structured format.

Options

  • metadata - Additional metadata including:
    • :level - The log level (:debug, :info, :warning, :error, etc.)

message(direction, type, id, data, metadata \\ [])

Log protocol messages with automatic formatting and context.

Parameters

  • direction - "incoming" or "outgoing"
  • type - message type (e.g., "request", "response", "notification", "error")
  • id - message ID (can be nil)
  • data - the message content
  • metadata - additional metadata to include with level option (:debug, :info, :warning, :error, etc.)

server_event(event, details, metadata \\ [])

Log server events with structured format.

Options

  • metadata - Additional metadata including:
    • :level - The log level (:debug, :info, :warning, :error, etc.)

transport_event(event, details, metadata \\ [])

Log transport events with structured format.

Options

  • metadata - Additional metadata including:
    • :level - The log level (:debug, :info, :warning, :error, etc.)