mirror of
https://gitee.com/johng/gf.git
synced 2024-12-04 13:18:01 +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) {
|
v, _ := internalCache.GetOrSetFuncLock(node.String(), func() (interface{}, error) {
|
||||||
sqlDb, err = c.db.Open(node)
|
sqlDb, err = c.db.Open(node)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
intlog.Printf("DB open failed: %v, %+v", err, node)
|
intlog.Printf(`db open failed: %v, %+v`, err, node)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
intlog.Printf(
|
||||||
|
`open new connection, master:%v, config:%+v, node:%+v`,
|
||||||
|
master, c.config, node,
|
||||||
|
)
|
||||||
if c.config.MaxIdleConnCount > 0 {
|
if c.config.MaxIdleConnCount > 0 {
|
||||||
sqlDb.SetMaxIdleConns(c.config.MaxIdleConnCount)
|
sqlDb.SetMaxIdleConns(c.config.MaxIdleConnCount)
|
||||||
} else {
|
} else {
|
||||||
|
@ -16,6 +16,7 @@ package gredis
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/gogf/gf/internal/intlog"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gogf/gf/container/gmap"
|
"github.com/gogf/gf/container/gmap"
|
||||||
@ -113,6 +114,7 @@ func New(config *Config) *Redis {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
intlog.Printf(`open new connection, config:%+v`, config)
|
||||||
// AUTH
|
// AUTH
|
||||||
if len(config.Pass) > 0 {
|
if len(config.Pass) > 0 {
|
||||||
if _, err := c.Do("AUTH", config.Pass); err != nil {
|
if _, err := c.Do("AUTH", config.Pass); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user