logging_test.go
This file
Path
logging_test.go
29 lines · 532 bytes · Go
Last changed by
Merge pull request #1118 from charmbracelet/v2-expAyman Bagabasbefore adoptiond1c8c97
History of this fileTake it
The walk stopped after 200 commits: lines older than 3dfbcd9 point at it.
feat(render): skipping lines from previous frameKonstantin Antonovbefore adoption3dfbcd9
lines 1–18why, one step back1package tea23import (4 "log"5 "os"6 "path/filepath"7 "testing"8)910func TestLogToFile(t *testing.T) {11 path := filepath.Join(t.TempDir(), "log.txt")12 prefix := "logprefix"13 f, err := LogToFile(path, prefix)14 if err != nil {15 t.Error(err)16 }17 log.SetFlags(log.Lmsgprefix)18 log.Println("some test log")Merge pull request #1118 from charmbracelet/v2-expAyman Bagabasbefore adoptiond1c8c97
lines 19–20why, one step back19 if closeErr := f.Close(); closeErr != nil {20 t.Error(closeErr)feat(render): skipping lines from previous frameKonstantin Antonovbefore adoption3dfbcd9
lines 21–29why, one step back21 }22 out, err := os.ReadFile(path)23 if err != nil {24 t.Error(err)25 }26 if string(out) != prefix+" some test log\n" {27 t.Fatalf("wrong log msg: %q", string(out))28 }29}