Documentation
¶
Overview ¶
Package logging provides utility and helper functions and structs related to logging activity for both internal logs (regarding the centian proxy) and MCP requests/respoonses.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrLogsDirNotFound = errors.New("centian logs directory not found")
ErrLogsDirNotFound is returned when the Centian logs directory is missing.
var ErrNoLogEntries = errors.New("no log entries found")
ErrNoLogEntries is returned when log files exist but contain no valid entries.
Functions ¶
func FormatDisplayLine ¶
func FormatDisplayLine(entry *AnnotatedLogEntry) string
FormatDisplayLine converts an AnnotatedLogEntry into a human-readable summary string.
func GetDefaultEventStorePath ¶ added in v0.2.0
GetDefaultEventStorePath returns the default SQLite path for durable event storage.
func GetLogsDirectory ¶
GetLogsDirectory returns the directory where Centian stores log files. Tests can override this path by setting the CENTIAN_LOG_DIR environment variable.
Types ¶
type ActionEventStore ¶ added in v0.2.0
ActionEventStore persists MCP action events in a queryable store.
type AnnotatedLogEntry ¶
AnnotatedLogEntry wraps a generic MCP event with contextual metadata used for display.
func LoadRecentLogEntries ¶
func LoadRecentLogEntries(limit int) ([]AnnotatedLogEntry, error)
LoadRecentLogEntries collects log entries from Centian log files, orders them by timestamp descending, and enforces an optional limit. A non-positive limit returns all available entries.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger handles log file I/O operations (base logger for all transports).
func NewDiscardLogger ¶ added in v0.4.3
NewDiscardLogger creates a logger that skips JSONL writes while still allowing action event persistence through SetActionEventStore.
func NewLoggerInDir ¶ added in v0.4.3
NewLoggerInDir creates a logger that writes request JSONL files in logDir.
func (*Logger) GetLogPath ¶
GetLogPath returns the absolute path to the current log file. This method can be used by external callers to:.
- Display log location to users for debugging.
- Access logs programmatically for analysis or monitoring.
- Integrate with external log aggregation tools.
- Provide log file paths in status/diagnostic outputs.
func (*Logger) LogEntry ¶ added in v0.0.3
LogEntry writes any log entry to the JSONL file (base Logger method).
func (*Logger) LogMcpEvent ¶
LogMcpEvent logs the provided stdio/http MCP event.
func (*Logger) SetActionEventStore ¶ added in v0.2.0
func (l *Logger) SetActionEventStore(store ActionEventStore)
SetActionEventStore configures an optional SQL/event sink for MCP action events.