summaryrefslogtreecommitdiff
path: root/internal/logging
diff options
context:
space:
mode:
Diffstat (limited to 'internal/logging')
-rw-r--r--internal/logging/logging_test.go33
1 files changed, 16 insertions, 17 deletions
diff --git a/internal/logging/logging_test.go b/internal/logging/logging_test.go
index 716781e..31603f0 100644
--- a/internal/logging/logging_test.go
+++ b/internal/logging/logging_test.go
@@ -1,24 +1,23 @@
package logging
import (
- "bytes"
- "log"
- "testing"
+ "bytes"
+ "log"
+ "testing"
)
func TestPreviewAndLogfAndChatLogger(t *testing.T) {
- var buf bytes.Buffer
- Bind(log.New(&buf, "", 0))
- SetLogPreviewLimit(3)
- if got := PreviewForLog("abcdef"); got != "abc…" {
- t.Fatalf("preview wrong: %q", got)
- }
- Logf("unit ", "hello %s", "x")
- cl := NewChatLogger("p")
- cl.LogStart(true, "m", 0.5, 100, []string{"stop"}, []struct{ Role, Content string }{{"user", "hello"}})
- out := buf.String()
- if out == "" || !bytes.Contains([]byte(out), []byte("start")) {
- t.Fatalf("expected logged content, got %q", out)
- }
+ var buf bytes.Buffer
+ Bind(log.New(&buf, "", 0))
+ SetLogPreviewLimit(3)
+ if got := PreviewForLog("abcdef"); got != "abc…" {
+ t.Fatalf("preview wrong: %q", got)
+ }
+ Logf("unit ", "hello %s", "x")
+ cl := NewChatLogger("p")
+ cl.LogStart(true, "m", 0.5, 100, []string{"stop"}, []struct{ Role, Content string }{{"user", "hello"}})
+ out := buf.String()
+ if out == "" || !bytes.Contains([]byte(out), []byte("start")) {
+ t.Fatalf("expected logged content, got %q", out)
+ }
}
-