v0.3.5 centralized formattig, refactored

This commit is contained in:
2025-07-15 01:24:41 -04:00
parent be5bb9f2bd
commit e88812bb09
19 changed files with 560 additions and 133 deletions
+31
View File
@@ -0,0 +1,31 @@
// FILE: src/internal/format/raw.go
package format
import (
"logwisp/src/internal/source"
"github.com/lixenwraith/log"
)
// RawFormatter outputs the log message as-is with a newline
type RawFormatter struct {
logger *log.Logger
}
// NewRawFormatter creates a new raw formatter
func NewRawFormatter(options map[string]any, logger *log.Logger) (*RawFormatter, error) {
return &RawFormatter{
logger: logger,
}, nil
}
// Format returns the message with a newline appended
func (f *RawFormatter) Format(entry source.LogEntry) ([]byte, error) {
// Simply return the message with newline
return append([]byte(entry.Message), '\n'), nil
}
// Name returns the formatter name
func (f *RawFormatter) Name() string {
return "raw"
}