Module: PostHog::MCP::Log Private

Defined in:
lib/posthog/mcp/log.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Logging for the MCP integration.

Debug-level chatter goes only to the logger: option (a no-op by default), because a stdio MCP server owns $stdout for the protocol and the core SDK's default logger writes there. Warnings additionally reach the app's logger when Rails is loaded (where Logging.logger wraps Rails.logger) and stderr otherwise, so misconfiguration is never silent and never corrupts a stdio transport.

Class Method Summary collapse

Class Method Details

.debug(options, message) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



18
19
20
21
22
23
# File 'lib/posthog/mcp/log.rb', line 18

def debug(options, message)
  sink = options.respond_to?(:logger) ? options.logger : nil
  sink&.call(message)
rescue StandardError
  nil
end

.warn(options, message) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
28
29
30
31
32
33
34
# File 'lib/posthog/mcp/log.rb', line 25

def warn(options, message)
  debug(options, message)
  if defined?(::Rails)
    PostHog::Logging.logger.warn(message)
  else
    Kernel.warn("[posthog-ruby] #{message}")
  end
rescue StandardError
  nil
end