v0.5.0: manifests, filters, logging, docs
pipeline / build (push) Has been cancelled
pipeline / test (push) Has been cancelled

This commit is contained in:
Ein Anderssono
2026-06-15 00:00:06 +02:00
parent 3d3c4a4742
commit 2e73d01b40
33 changed files with 7238 additions and 512 deletions
+39
View File
@@ -0,0 +1,39 @@
package manifest
import (
"encoding/json"
"os"
"sync"
)
type fileLogWriter struct {
mu sync.Mutex
f *os.File
}
func NewFileLogWriter(path string) (LogWriter, error) {
f, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)
if err != nil {
return nil, err
}
return &fileLogWriter{f: f}, nil
}
func (w *fileLogWriter) Log(e LogEntry) {
data, _ := json.Marshal(e)
w.mu.Lock()
defer w.mu.Unlock()
if w.f != nil {
w.f.Write(data)
w.f.Write([]byte("\n"))
}
}
func (w *fileLogWriter) Close() {
w.mu.Lock()
defer w.mu.Unlock()
if w.f != nil {
w.f.Close()
w.f = nil
}
}