From 1d19526629414e694fc1e0252f63a16f4202d480 Mon Sep 17 00:00:00 2001 From: Pavel Shevaev Date: Thu, 3 Nov 2022 12:53:08 +0300 Subject: [PATCH] Migrating to unified logger interface --- db.go | 6 +++--- db_test.go | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/db.go b/db.go index 74193d2..c5b1b01 100644 --- a/db.go +++ b/db.go @@ -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}) diff --git a/db_test.go b/db_test.go index f884743..65bb2e1 100644 --- a/db_test.go +++ b/db_test.go @@ -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 {