logging

package
v0.59.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 8 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

Close closes the log file if open.

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

func GetAllDebugLogPaths() ([]string, error)

GetAllDebugLogPaths returns paths to all debug log files (port-specific and legacy).

func GetAllMainLogPaths added in v0.40.0

func GetAllMainLogPaths() ([]string, error)

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

func GetDebugLogPathForPort(port int) string

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

func GetLogPathForPort(port int) string

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 IsFileMode

func IsFileMode() bool

IsFileMode returns true if logging to file.

func ListAllLogFiles added in v0.40.0

func ListAllLogFiles() ([]string, error)

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

func LogDebugRequestRaw(direction, endpoint string, data []byte)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL