mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-27 03:58:55 +08:00
connID to md5
This commit is contained in:
parent
e28e6891d4
commit
54a74c0b82
@ -6,6 +6,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gorm.io/driver/mysql"
|
"gorm.io/driver/mysql"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
@ -41,7 +42,6 @@ func newMysqlGormDB() (*gorm.DB, error) {
|
|||||||
SlowThreshold: time.Duration(config.Config.Mysql.SlowThreshold) * time.Millisecond, // Slow SQL threshold
|
SlowThreshold: time.Duration(config.Config.Mysql.SlowThreshold) * time.Millisecond, // Slow SQL threshold
|
||||||
LogLevel: logger.LogLevel(config.Config.Mysql.LogLevel), // Log level
|
LogLevel: logger.LogLevel(config.Config.Mysql.LogLevel), // Log level
|
||||||
IgnoreRecordNotFoundError: true, // Ignore ErrRecordNotFound error for logger
|
IgnoreRecordNotFoundError: true, // Ignore ErrRecordNotFound error for logger
|
||||||
Colorful: true, // Disable color
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
db, err = gorm.Open(mysql.Open(dsn), &gorm.Config{
|
db, err = gorm.Open(mysql.Open(dsn), &gorm.Config{
|
||||||
@ -68,5 +68,9 @@ func NewGormDB() (*gorm.DB, error) {
|
|||||||
type Writer struct{}
|
type Writer struct{}
|
||||||
|
|
||||||
func (w Writer) Printf(format string, args ...interface{}) {
|
func (w Writer) Printf(format string, args ...interface{}) {
|
||||||
log.ZDebug(context.Background(), format)
|
var s []string
|
||||||
|
for _, v := range args {
|
||||||
|
s = append(s, fmt.Sprintf("%v", v))
|
||||||
|
}
|
||||||
|
log.ZDebug(context.Background(), format, "sql", strings.Join(s, ""))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user