diff options
Diffstat (limited to 'internal/logging')
| -rw-r--r-- | internal/logging/chatlogger.go | 28 | ||||
| -rw-r--r-- | internal/logging/logging.go | 1 |
2 files changed, 28 insertions, 1 deletions
diff --git a/internal/logging/chatlogger.go b/internal/logging/chatlogger.go new file mode 100644 index 0000000..b6b84a3 --- /dev/null +++ b/internal/logging/chatlogger.go @@ -0,0 +1,28 @@ +package logging + +// ChatLogger provides a structured way to log chat interactions. +type ChatLogger struct { + Provider string +} + +// NewChatLogger creates a new ChatLogger for a given provider. +func NewChatLogger(provider string) *ChatLogger { + return &ChatLogger{Provider: provider} +} + +// LogStart logs the beginning of a chat or stream interaction. +func (cl *ChatLogger) LogStart(stream bool, model string, temp float64, maxTokens int, stop []string, messages []struct { + Role string + Content string +}) { + chatOrStream := "chat" + if stream { + chatOrStream = "stream" + } + Logf("llm/"+cl.Provider+" ", "%s start model=%s temp=%.2f max_tokens=%d stop=%d messages=%d", + chatOrStream, model, temp, maxTokens, len(stop), len(messages)) + for i, m := range messages { + Logf("llm/"+cl.Provider+" ", "msg[%d] role=%s size=%d preview=%s%s%s", + i, m.Role, len(m.Content), AnsiCyan, PreviewForLog(m.Content), AnsiBase) + } +} diff --git a/internal/logging/logging.go b/internal/logging/logging.go index b82ee99..2975c7a 100644 --- a/internal/logging/logging.go +++ b/internal/logging/logging.go @@ -1,5 +1,4 @@ // Summary: ANSI-styled logging utilities with a bound standard logger and configurable preview truncation. -// Not yet reviewed by a human package logging import ( |
