diff options
Diffstat (limited to 'internal/config')
-rw-r--r-- | internal/config/config.go | 6 | ||||
-rw-r--r-- | internal/config/structs.go | 11 |
2 files changed, 9 insertions, 8 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index 14375d6..f3c0b57 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -1,7 +1,6 @@ package config import ( - "log/slog" "maps" "net/url" "os" @@ -9,6 +8,7 @@ import ( "github.com/pelletier/go-toml/v2" "github.com/pkg/errors" + "go.alanpearce.eu/x/log" ) var Version string @@ -102,10 +102,10 @@ func mustLocalTime(in string) (time LocalTime) { return } -func GetConfig(filename string) (*Config, error) { +func GetConfig(filename string, log *log.Logger) (*Config, error) { config := DefaultConfig if filename != "" { - slog.Debug("reading config", "filename", filename) + log.Debug("reading config", "filename", filename) f, err := os.Open(filename) if err != nil { return nil, errors.Wrap(err, "reading config failed") diff --git a/internal/config/structs.go b/internal/config/structs.go index e6cf20b..dd79303 100644 --- a/internal/config/structs.go +++ b/internal/config/structs.go @@ -5,14 +5,15 @@ package config import ( "fmt" - "log/slog" + + "go.uber.org/zap/zapcore" ) type Config struct { - DataPath string `comment:"Path to store index data."` - LogLevel slog.Level `comment:"How much information to log, one of 'debug', 'info', 'warn', 'error'."` - Web *Web `comment:"Settings for the web server"` - Importer *Importer `comment:"Settings for the import job"` + DataPath string `comment:"Path to store index data."` + LogLevel zapcore.Level `comment:"How much information to log, one of 'debug', 'info', 'warn', 'error', 'panic', 'fatal'."` + Web *Web `comment:"Settings for the web server"` + Importer *Importer `comment:"Settings for the import job"` } type Web struct { |