Initialize narratio Go module and CLI scaffold

This commit is contained in:
2026-05-02 10:37:38 -05:00
parent 48c51e1c77
commit 902e6bc994
42 changed files with 1486 additions and 1 deletions

View File

@@ -0,0 +1,31 @@
package logging
import (
"bytes"
"log/slog"
"strings"
"testing"
)
func TestNewLoggerWritesOutput(t *testing.T) {
var buf bytes.Buffer
logger := NewLogger(&buf, slog.LevelInfo)
if logger == nil {
t.Fatal("logger is nil")
}
logger.Info("hello", "component", "test")
out := buf.String()
if !strings.Contains(out, "hello") {
t.Fatalf("output = %q, want to contain message", out)
}
}
func TestNewLoggerNilWriter(t *testing.T) {
logger := NewLogger(nil, slog.LevelInfo)
if logger == nil {
t.Fatal("logger is nil")
}
logger.Info("should not panic")
}