优化结构

This commit is contained in:
Yvan
2026-08-20 20:39:09 +08:00
parent b88c220e20
commit 01b5c2f78a
73 changed files with 3171 additions and 794 deletions
+2 -1
View File
@@ -8,6 +8,7 @@ import (
"testing"
"time"
"kra/pkg/gormkit"
"kra/pkg/logging"
"gorm.io/gorm/logger"
@@ -16,7 +17,7 @@ import (
func TestGORMLoggerUsesApplicationCategories(t *testing.T) {
root := t.TempDir()
appLogger, cleanup := logging.NewZapLogger(root, "application.log", logging.Options{Level: "info", Format: "json"})
databaseLogger := newGormLogger(appLogger, logger.Info)
databaseLogger := gormkit.NewLogger(appLogger, logger.Info)
databaseLogger.Trace(context.Background(), time.Now(), func() (string, int64) { return "SELECT 1", 1 }, nil)
databaseLogger.Trace(context.Background(), time.Now(), func() (string, int64) { return "SELECT missing", 0 }, errors.New("database failure"))
cleanup()