mirror of
https://gitee.com/johng/gf.git
synced 2024-12-03 12:47:50 +08:00
add internal logging for package gdb/gredis
This commit is contained in:
parent
20f2a6c003
commit
7702c5bfde
@ -473,9 +473,13 @@ func (c *Core) getSqlDb(master bool, schema ...string) (sqlDb *sql.DB, err error
|
||||
v, _ := internalCache.GetOrSetFuncLock(node.String(), func() (interface{}, error) {
|
||||
sqlDb, err = c.db.Open(node)
|
||||
if err != nil {
|
||||
intlog.Printf("DB open failed: %v, %+v", err, node)
|
||||
intlog.Printf(`db open failed: %v, %+v`, err, node)
|
||||
return nil, err
|
||||
}
|
||||
intlog.Printf(
|
||||
`open new connection, master:%v, config:%+v, node:%+v`,
|
||||
master, c.config, node,
|
||||
)
|
||||
if c.config.MaxIdleConnCount > 0 {
|
||||
sqlDb.SetMaxIdleConns(c.config.MaxIdleConnCount)
|
||||
} else {
|
||||
|
@ -16,6 +16,7 @@ package gredis
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/gogf/gf/internal/intlog"
|
||||
"time"
|
||||
|
||||
"github.com/gogf/gf/container/gmap"
|
||||
@ -113,6 +114,7 @@ func New(config *Config) *Redis {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
intlog.Printf(`open new connection, config:%+v`, config)
|
||||
// AUTH
|
||||
if len(config.Pass) > 0 {
|
||||
if _, err := c.Do("AUTH", config.Pass); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user