From fee3f675d51a8a8c225809c392b9a11154daa32d Mon Sep 17 00:00:00 2001 From: timerzz Date: Thu, 30 May 2024 21:41:05 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E4=BF=AE=E6=94=B9=E6=85=A2sql=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 2 +- go.sum | 2 ++ main/main.go | 10 +++++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 5e443b5..4bdef88 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.22.2 toolchain go1.22.3 require ( - gitea.timerzz.com/kedaya_haitao/common v0.0.0-20240521073651-0653521e73ea + gitea.timerzz.com/kedaya_haitao/common v0.0.0-20240530133209-38f473928f02 gitea.timerzz.com/kedaya_haitao/pusher v0.0.0-20240521124219-55c7fe31e0e1 github.com/gofiber/fiber/v3 v3.0.0-beta.2 github.com/golang/glog v1.2.1 diff --git a/go.sum b/go.sum index 569095d..f3f8393 100644 --- a/go.sum +++ b/go.sum @@ -4,6 +4,8 @@ gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zum git.sr.ht/~sbinet/gg v0.3.1/go.mod h1:KGYtlADtqsqANL9ueOFkWymvzUvLMQllU5Ixo+8v3pc= gitea.timerzz.com/kedaya_haitao/common v0.0.0-20240521073651-0653521e73ea h1:asjEGs0rxu+pMXEd6bWipoingfhLBG1qP3Gt6lSy2Kg= gitea.timerzz.com/kedaya_haitao/common v0.0.0-20240521073651-0653521e73ea/go.mod h1:cgLy4gB0z2UZD3kBp1IAemt28dkaKNdt4RC0LNkE1I8= +gitea.timerzz.com/kedaya_haitao/common v0.0.0-20240530133209-38f473928f02 h1:bjpd9t8dSCmH488m6qnzSWWj9a/Gih0m1gIqjVuF1hk= +gitea.timerzz.com/kedaya_haitao/common v0.0.0-20240530133209-38f473928f02/go.mod h1:cgLy4gB0z2UZD3kBp1IAemt28dkaKNdt4RC0LNkE1I8= gitea.timerzz.com/kedaya_haitao/pusher v0.0.0-20240521124219-55c7fe31e0e1 h1:OyFVnuMB4LaYNnxSizu/uWmHa1lF4BetAilV8xn6QX4= gitea.timerzz.com/kedaya_haitao/pusher v0.0.0-20240521124219-55c7fe31e0e1/go.mod h1:4N9xAFCbyuoyNVvJpwZ64UlnRlJ7AMQeJfTNLJZYoto= github.com/3andne/restls-client-go v0.1.6 h1:tRx/YilqW7iHpgmEL4E1D8dAsuB0tFF3uvncS+B6I08= diff --git a/main/main.go b/main/main.go index 793eb7e..e897337 100644 --- a/main/main.go +++ b/main/main.go @@ -9,12 +9,15 @@ import ( "github.com/gofiber/fiber/v3" "github.com/gofiber/fiber/v3/middleware/cors" "github.com/golang/glog" + "gorm.io/gorm/logger" "haitao_watcher/pkg/options" "haitao_watcher/pkg/watcher" "haitao_watcher/server" + "log" "log/slog" "os" "os/signal" + "time" ) func main() { @@ -29,7 +32,12 @@ func main() { if err != nil { glog.Fatalf("初始化数据库失败:%v", err) } - + db.Logger = logger.New(log.New(os.Stdout, "\r\n", log.LstdFlags), logger.Config{ + SlowThreshold: time.Second, + LogLevel: logger.Warn, + IgnoreRecordNotFoundError: false, + Colorful: true, + }) pool := proxy.NewProxyPool(cfg.Proxy.Subscribes) go pool.CronUpdate(ctx, cfg.Proxy.Interval) //定时更新代理