feedkit: ergonomics pass (shared logger, route compiler, param helpers)
- Add logging.Logf as the canonical printf-style logger type used across feedkit.
- Update scheduler and dispatch to alias their Logger types to logging.Logf.
- Eliminates type-mismatch friction when wiring one log function through the system.
- Add dispatch.CompileRoutes(*config.Config) ([]dispatch.Route, error)
- Compiles config routes into dispatch routes with event.ParseKind normalization.
- If routes: is omitted, defaults to “all sinks receive all kinds”.
- Expand config param helpers for both SourceConfig and SinkConfig
- Add ParamBool/ParamInt/ParamDuration/ParamStringSlice (+ Default variants).
- Supports common YAML-decoded types (bool/int/float/string, []any, etc.)
- Keeps driver code cleaner and reduces repeated type assertions.
- Fix Postgres sink validation error prefix ("postgres sink", not "rabbitmq sink").
This commit is contained in:
@@ -8,9 +8,15 @@ import (
|
||||
"time"
|
||||
|
||||
"gitea.maximumdirect.net/ejr/feedkit/event"
|
||||
"gitea.maximumdirect.net/ejr/feedkit/logging"
|
||||
"gitea.maximumdirect.net/ejr/feedkit/sources"
|
||||
)
|
||||
|
||||
// Logger is a printf-style logger used throughout scheduler.
|
||||
// It is an alias to the shared feedkit logging type so callers can pass
|
||||
// one function everywhere without type mismatch friction.
|
||||
type Logger = logging.Logf
|
||||
|
||||
type Job struct {
|
||||
Source sources.Source
|
||||
Every time.Duration
|
||||
@@ -23,8 +29,6 @@ type Job struct {
|
||||
Jitter time.Duration
|
||||
}
|
||||
|
||||
type Logger func(format string, args ...any)
|
||||
|
||||
type Scheduler struct {
|
||||
Jobs []Job
|
||||
Out chan<- event.Event
|
||||
|
||||
Reference in New Issue
Block a user