Migrating to unified logger interface

This commit is contained in:
Pavel Shevaev 2022-11-03 12:53:08 +03:00
parent e0a3baffb9
commit 1d19526629
2 changed files with 5 additions and 4 deletions

6
db.go
View File

@ -74,9 +74,9 @@ func OpenPool(s Settings) *Pool {
func GetDBC(p *Pool, logger logr.Logger) *DBC {
if len(p.S.Prefix) > 0 {
logger = logger.WithValues("db", p.S.Prefix)
}
if len(p.S.Prefix) > 0 {
logger = logger.WithValues("db_prefix", p.S.Prefix)
}
con := dbr.NewConnection(p.DB, nil)
sess := con.NewSession(&EventReceiver{logger: logger, s: p.S})

View File

@ -17,7 +17,8 @@ var logger = stdr.New(log.New(os.Stdout, "", log.Lshortfile))
func getSettings() db.Settings {
//TODO: use ENV settings as well
return db.Settings{Host: "127.0.0.1", Port: "3306", User: "root", Pass: "test", Name: "tests", Prefix: "tests"}
//stdr.SetVerbosity(2)
return db.Settings{Host: "127.0.0.1", Port: "3306", User: "root", Pass: "test", Name: "tests", Prefix: "tests"}
}
func getPool() *db.Pool {