Documentation
¶
Index ¶
- func GetLogPath() string
- func LogRequestPayload(payload []byte, provider, model string, streaming bool)
- func LogRequestPayloadOnError(payload []byte, provider, model string, streaming bool, errorType string, ...)
- func WriteLocalCopy(filename string, content []byte)
- func WriteLocalCopyRequest(filename string, data []byte)
- type Logger
- func (l *Logger) Close() error
- func (l *Logger) Debug(format string, args ...interface{})
- func (l *Logger) Error(format string, args ...interface{})
- func (l *Logger) Info(format string, args ...interface{})
- func (l *Logger) Log(level string, format string, args ...interface{})
- func (l *Logger) Warn(format string, args ...interface{})
- type StructuredLogger
- func (l *StructuredLogger) Debug(msg string, args ...interface{})
- func (l *StructuredLogger) Error(msg string, args ...interface{})
- func (l *StructuredLogger) Info(msg string, args ...interface{})
- func (l *StructuredLogger) Warn(msg string, args ...interface{})
- func (l *StructuredLogger) WithContext(sessionID, chatID, clientID string) *StructuredLogger
- func (l *StructuredLogger) WithError(err error) *StructuredLogger
- func (l *StructuredLogger) WithField(key string, value interface{}) *StructuredLogger
- func (l *StructuredLogger) WithProvider(provider, model string) *StructuredLogger
- func (l *StructuredLogger) WithTool(toolName, toolID string) *StructuredLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogRequestPayload ¶
LogRequestPayload saves the exact JSON payload sent to the provider. It writes both the canonical lastRequest.json and a timestamped diagnostic copy. All payloads are redacted via pkg/redact to prevent credential leakage in log files.
func LogRequestPayloadOnError ¶
func LogRequestPayloadOnError(payload []byte, provider, model string, streaming bool, errorType string, err error)
LogRequestPayloadOnError saves the JSON payload only when an error occurs. It writes to lastRequest.json and a timestamped file with error context. All payloads are redacted via pkg/redact to prevent credential leakage in log files.
func WriteLocalCopy ¶
WriteLocalCopy writes a copy of content to a local log file for debugging
func WriteLocalCopyRequest ¶
WriteLocalCopy optionally mirrors log files to the current working directory.
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger provides structured logging functionality
type StructuredLogger ¶
type StructuredLogger struct {
// contains filtered or unexported fields
}
StructuredLogger wraps slog.Logger with domain-specific convenience methods for consistent structured logging throughout the agent codebase.
var Default *StructuredLogger
Default is the global logger instance initialized on first use
func NewStructuredLogger ¶
func NewStructuredLogger() *StructuredLogger
NewStructuredLogger creates a new logger writing to stderr with JSON handler
func (*StructuredLogger) Debug ¶
func (l *StructuredLogger) Debug(msg string, args ...interface{})
Debug logs at debug level
func (*StructuredLogger) Error ¶
func (l *StructuredLogger) Error(msg string, args ...interface{})
Error logs at error level
func (*StructuredLogger) Info ¶
func (l *StructuredLogger) Info(msg string, args ...interface{})
Info logs at info level
func (*StructuredLogger) Warn ¶
func (l *StructuredLogger) Warn(msg string, args ...interface{})
Warn logs at warn level
func (*StructuredLogger) WithContext ¶
func (l *StructuredLogger) WithContext(sessionID, chatID, clientID string) *StructuredLogger
WithContext returns a logger with session/conversation context
func (*StructuredLogger) WithError ¶
func (l *StructuredLogger) WithError(err error) *StructuredLogger
WithError returns a logger with error context
func (*StructuredLogger) WithField ¶
func (l *StructuredLogger) WithField(key string, value interface{}) *StructuredLogger
WithField adds an arbitrary key-value pair
func (*StructuredLogger) WithProvider ¶
func (l *StructuredLogger) WithProvider(provider, model string) *StructuredLogger
WithProvider returns a logger with provider/model context
func (*StructuredLogger) WithTool ¶
func (l *StructuredLogger) WithTool(toolName, toolID string) *StructuredLogger
WithTool returns a logger with tool execution context