Hermes.Logging (hermes_mcp v0.3.12)

Centralized logging for Hermes MCP client.

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

Summary

Functions

Add context to existing metadata for all subsequent logs.

Log client events with structured format.

Set context for all subsequent logs in the current process.

Log protocol messages with automatic formatting and context.

Log server events with structured format.

Log transport events with structured format.

Functions

add_context(metadata)

Add context to existing metadata for all subsequent logs.

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.)

context(metadata)

Set context for all subsequent logs in the current process.

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.)