v0.3.10 config auto-save added, dependency update, limiter packages refactored

This commit is contained in:
2025-09-01 16:16:52 -04:00
parent 3c74a6336e
commit fce6ee5c65
32 changed files with 309 additions and 181 deletions

View File

@ -4,7 +4,7 @@ package format
import (
"fmt"
"logwisp/src/internal/source"
"logwisp/src/internal/core"
"github.com/lixenwraith/log"
)
@ -12,7 +12,7 @@ import (
// Formatter defines the interface for transforming a LogEntry into a byte slice.
type Formatter interface {
// Format takes a LogEntry and returns the formatted log as a byte slice.
Format(entry source.LogEntry) ([]byte, error)
Format(entry core.LogEntry) ([]byte, error)
// Name returns the formatter type name
Name() string

View File

@ -6,7 +6,7 @@ import (
"fmt"
"time"
"logwisp/src/internal/source"
"logwisp/src/internal/core"
"github.com/lixenwraith/log"
)
@ -52,7 +52,7 @@ func NewJSONFormatter(options map[string]any, logger *log.Logger) (*JSONFormatte
}
// Format formats the log entry as JSON
func (f *JSONFormatter) Format(entry source.LogEntry) ([]byte, error) {
func (f *JSONFormatter) Format(entry core.LogEntry) ([]byte, error) {
// Start with a clean map
output := make(map[string]any)
@ -122,7 +122,7 @@ func (f *JSONFormatter) Name() string {
// FormatBatch formats multiple entries as a JSON array
// This is a special method for sinks that need to batch entries
func (f *JSONFormatter) FormatBatch(entries []source.LogEntry) ([]byte, error) {
func (f *JSONFormatter) FormatBatch(entries []core.LogEntry) ([]byte, error) {
// For batching, we need to create an array of formatted objects
batch := make([]json.RawMessage, 0, len(entries))

View File

@ -2,7 +2,7 @@
package format
import (
"logwisp/src/internal/source"
"logwisp/src/internal/core"
"github.com/lixenwraith/log"
)
@ -20,7 +20,7 @@ func NewRawFormatter(options map[string]any, logger *log.Logger) (*RawFormatter,
}
// Format returns the message with a newline appended
func (f *RawFormatter) Format(entry source.LogEntry) ([]byte, error) {
func (f *RawFormatter) Format(entry core.LogEntry) ([]byte, error) {
// Simply return the message with newline
return append([]byte(entry.Message), '\n'), nil
}

View File

@ -8,7 +8,7 @@ import (
"text/template"
"time"
"logwisp/src/internal/source"
"logwisp/src/internal/core"
"github.com/lixenwraith/log"
)
@ -59,7 +59,7 @@ func NewTextFormatter(options map[string]any, logger *log.Logger) (*TextFormatte
}
// Format formats the log entry using the template
func (f *TextFormatter) Format(entry source.LogEntry) ([]byte, error) {
func (f *TextFormatter) Format(entry core.LogEntry) ([]byte, error) {
// Prepare data for template
data := map[string]any{
"Timestamp": entry.Time,