:art:添加gorm默认日志

This commit is contained in:
comma
2025-10-25 22:53:00 +08:00
parent 90a3900b76
commit 7d94394da9
2 changed files with 10 additions and 2 deletions

View File

@@ -11,6 +11,14 @@ import (
"gorm.io/gorm/logger" "gorm.io/gorm/logger"
) )
var DefaultGormLogger = NewGormLogger(logger.Config{
SlowThreshold: 2 * time.Second,
Colorful: false,
IgnoreRecordNotFoundError: false,
ParameterizedQueries: false,
LogLevel: logger.Info,
})
type gormLogger struct{ logger.Config } type gormLogger struct{ logger.Config }
func NewGormLogger(gl logger.Config) *gormLogger { func NewGormLogger(gl logger.Config) *gormLogger {

View File

@@ -3,7 +3,7 @@ package zap_logger
import ( import (
"testing" "testing"
"gitee.ltd/lxh/logger/v2/log" "code.mrx.ltd/pkg/logger/log"
) )
func TestNewZapLogger(t *testing.T) { func TestNewZapLogger(t *testing.T) {