Documentation
¶
Overview ¶
Package logging provides log management for CLASP, including file-based logging when running in Claude Code mode to prevent TUI corruption. Supports multiple concurrent CLASP instances with session-specific log files.
Index ¶
- func Close()
- func ConfigureForClaudeCode() error
- func ConfigureForProxyOnly()
- func ConfigureQuiet()
- func DisableDebugLogging()
- func EnableDebugLogging() error
- func GenerateSessionID() string
- func GetAllDebugLogPaths() ([]string, error)
- func GetAllMainLogPaths() ([]string, error)
- func GetCurrentLogPath() string
- func GetDebugLogFilePath() string
- func GetDebugLogPath() string
- func GetDebugLogPathForPort(port int) string
- func GetLogPath() string
- func GetLogPathForPort(port int) string
- func GetSessionID() string
- func IsDebugEnabled() bool
- func IsFileMode() bool
- func ListAllLogFiles() ([]string, error)
- func LogDebugMessage(format string, args ...interface{})
- func LogDebugRequest(direction, endpoint string, payload interface{})
- func LogDebugRequestRaw(direction, endpoint string, data []byte)
- func LogDebugSSE(direction, eventType, data string)
- func SetSessionPort(port int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureForClaudeCode ¶
func ConfigureForClaudeCode() error
ConfigureForClaudeCode configures logging for Claude Code mode. All log output is redirected to a file to prevent TUI corruption. Generates a unique session ID for this CLASP instance.
func ConfigureForProxyOnly ¶
func ConfigureForProxyOnly()
ConfigureForProxyOnly configures logging for proxy-only mode. Logs go to stdout for debugging visibility.
func ConfigureQuiet ¶
func ConfigureQuiet()
ConfigureQuiet suppresses all log output (discard mode).
func DisableDebugLogging ¶ added in v0.27.0
func DisableDebugLogging()
DisableDebugLogging disables detailed logging.
func EnableDebugLogging ¶ added in v0.27.0
func EnableDebugLogging() error
EnableDebugLogging enables detailed request/response logging to debug.log. Uses session-specific log file if a port has been set.
func GenerateSessionID ¶ added in v0.40.0
func GenerateSessionID() string
GenerateSessionID creates a unique session identifier using PID and timestamp. Format: <pid>-<timestamp> (e.g., "12345-20251208153045")
func GetAllDebugLogPaths ¶ added in v0.40.0
GetAllDebugLogPaths returns paths to all debug log files (port-specific and legacy).
func GetAllMainLogPaths ¶ added in v0.40.0
GetAllMainLogPaths returns paths to all main log files (port-specific and legacy).
func GetCurrentLogPath ¶
func GetCurrentLogPath() string
GetCurrentLogPath returns the current log file path, or empty if not logging to file.
func GetDebugLogFilePath ¶ added in v0.27.0
func GetDebugLogFilePath() string
GetDebugLogFilePath returns the current debug log file path.
func GetDebugLogPath ¶ added in v0.27.0
func GetDebugLogPath() string
GetDebugLogPath returns the path to the CLASP debug log file. Returns a port-specific path if a port has been set, otherwise returns the default path.
func GetDebugLogPathForPort ¶ added in v0.40.0
GetDebugLogPathForPort returns the path to the CLASP debug log file for a specific port.
func GetLogPath ¶
func GetLogPath() string
GetLogPath returns the path to the CLASP log file. Returns a port-specific path if a port has been set, otherwise returns the default path.
func GetLogPathForPort ¶ added in v0.40.0
GetLogPathForPort returns the path to the CLASP log file for a specific port.
func GetSessionID ¶ added in v0.40.0
func GetSessionID() string
GetSessionID returns the current session identifier.
func IsDebugEnabled ¶ added in v0.27.0
func IsDebugEnabled() bool
IsDebugEnabled returns true if debug logging is enabled.
func ListAllLogFiles ¶ added in v0.40.0
ListAllLogFiles returns a list of all CLASP log files (main and debug). This is useful for the logs command to show logs from all instances.
func LogDebugMessage ¶ added in v0.27.0
func LogDebugMessage(format string, args ...interface{})
LogDebugMessage logs a simple message to the debug log. Includes session ID for multi-instance tracking.
func LogDebugRequest ¶ added in v0.27.0
func LogDebugRequest(direction, endpoint string, payload interface{})
LogDebugRequest logs a full request payload to the debug log. The payload is pretty-printed JSON for easier reading. Includes session ID for multi-instance tracking.
func LogDebugRequestRaw ¶ added in v0.27.0
LogDebugRequestRaw logs raw request/response data to the debug log. Includes session ID for multi-instance tracking.
func LogDebugSSE ¶ added in v0.27.0
func LogDebugSSE(direction, eventType, data string)
LogDebugSSE logs an SSE event to the debug log. Includes session ID for multi-instance tracking.
func SetSessionPort ¶ added in v0.40.0
func SetSessionPort(port int)
SetSessionPort sets the port for this CLASP instance. This should be called after the port is determined to create session-specific logs.
Types ¶
This section is empty.