redefine logging Config to Cfg

This commit is contained in:
Helmut Merz 2023-06-24 10:37:24 +02:00
parent 72abf7cc0f
commit 2712f3cb38
4 changed files with 8 additions and 6 deletions

View file

@ -17,7 +17,7 @@ type Cfg struct {
*config.BaseCfg
AppType string
Home string
Logging *logging.Config
Logging *logging.Cfg
}
func Start(ctx lib.Context) {

View file

@ -14,7 +14,7 @@ func Config() lib.Config {
BaseCfg: b("dummy", app.Start),
Home: ovr(".", HOME),
AppType: "standard",
Logging: &logging.Config{
Logging: &logging.Cfg{
Logfile: ovr("log/scopes.log", LOGFILE),
},
}

View file

@ -4,6 +4,7 @@ import (
"fmt"
"path/filepath"
"git.sr.ht/~cco/go-scopes/config"
"git.sr.ht/~cco/go-scopes/lib"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
@ -13,12 +14,13 @@ type Logger = zerolog.Logger
var globalLogger Logger = log.Logger
type Config struct {
type Cfg struct {
*config.BaseCfg
Logfile string
Level zerolog.Level
}
func Setup(ctx lib.Context, cfg *Config, home string) {
func Setup(ctx lib.Context, cfg *Cfg, home string) {
if cfg == nil {
return // use unchanged predefined logger
}
@ -32,7 +34,7 @@ func Setup(ctx lib.Context, cfg *Config, home string) {
fmt.Println("logfile:", fn)
}
func New(cfg *Config, home string) *Logger {
func New(cfg *Cfg, home string) *Logger {
return nil
}

View file

@ -18,7 +18,7 @@ func Config() lib.Config {
BaseCfg: b("testing", testing.Start),
Home: ovr(".", HOME),
AppType: "standard",
Logging: &logging.Config{
Logging: &logging.Cfg{
Logfile: ovr("log/scopes.log", LOGFILE),
},
}