From 7782af1a2405458678bb54675755b7369ba59008 Mon Sep 17 00:00:00 2001 From: storezhang Date: Wed, 25 Oct 2023 14:07:35 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=97=A5=E5=BF=97):=20=E4=BD=BF?= =?UTF-8?q?=E7=94=A8goexl/log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- builder.go | 4 ++-- go.mod | 10 +++------- job_default.go | 6 +++--- job_once.go | 6 +++--- params.go | 6 +++--- schedule_duration.go | 6 +++--- schedule_time.go | 6 +++--- 7 files changed, 20 insertions(+), 24 deletions(-) diff --git a/builder.go b/builder.go index 5e76e74..35cba03 100644 --- a/builder.go +++ b/builder.go @@ -1,7 +1,7 @@ package schedule import ( - "github.com/goexl/simaqian" + "github.com/goexl/log" ) type builder struct { @@ -14,7 +14,7 @@ func newBuilder() *builder { } } -func (b *builder) Logger(logger simaqian.Logger) *builder { +func (b *builder) Logger(logger log.Logger) *builder { b.params.logger = logger return b diff --git a/go.mod b/go.mod index 5e944ce..db0a5b4 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,11 @@ module github.com/goexl/schedule -go 1.19 +go 1.21 require ( github.com/goexl/exc v0.0.5 - github.com/goexl/gox v0.3.2 - github.com/goexl/simaqian v0.2.5 + github.com/goexl/gox v0.3.8 + github.com/goexl/log v0.0.5 github.com/robfig/cron/v3 v3.0.1 github.com/shirou/gopsutil/v3 v3.23.9 ) @@ -15,12 +15,8 @@ require ( github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a // indirect github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b // indirect github.com/shoenig/go-m1cpu v0.1.6 // indirect - github.com/sirupsen/logrus v1.9.0 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect - go.uber.org/atomic v1.10.0 // indirect - go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.24.0 // indirect golang.org/x/sys v0.12.0 // indirect ) diff --git a/job_default.go b/job_default.go index b1cbb20..6821714 100644 --- a/job_default.go +++ b/job_default.go @@ -3,7 +3,7 @@ package schedule import ( "github.com/goexl/gox" "github.com/goexl/gox/field" - "github.com/goexl/simaqian" + "github.com/goexl/log" "github.com/robfig/cron/v3" ) @@ -11,10 +11,10 @@ var _ cron.Job = (*jobDefault)(nil) type jobDefault struct { worker worker - logger simaqian.Logger + logger log.Logger } -func newDefaultJob(worker worker, logger simaqian.Logger) *jobDefault { +func newDefaultJob(worker worker, logger log.Logger) *jobDefault { return &jobDefault{ worker: worker, logger: logger, diff --git a/job_once.go b/job_once.go index 8a518ad..1115669 100644 --- a/job_once.go +++ b/job_once.go @@ -3,7 +3,7 @@ package schedule import ( "github.com/goexl/gox" "github.com/goexl/gox/field" - "github.com/goexl/simaqian" + "github.com/goexl/log" ) type jobOnce struct { @@ -11,12 +11,12 @@ type jobOnce struct { scheduler *Scheduler worker worker - logger simaqian.Logger + logger log.Logger deleted bool executed bool } -func newOnceJob(id *string, scheduler *Scheduler, worker worker, logger simaqian.Logger) *jobOnce { +func newOnceJob(id *string, scheduler *Scheduler, worker worker, logger log.Logger) *jobOnce { return &jobOnce{ id: id, scheduler: scheduler, diff --git a/params.go b/params.go index bda94b0..c16ce20 100644 --- a/params.go +++ b/params.go @@ -1,17 +1,17 @@ package schedule import ( - "github.com/goexl/simaqian" + "github.com/goexl/log" ) type params struct { - logger simaqian.Logger + logger log.Logger unique bool limit *limitParams } func newParams() *params { return ¶ms{ - logger: simaqian.Default(), + logger: log.New().Apply(), } } diff --git a/schedule_duration.go b/schedule_duration.go index 9731ad3..dd578fa 100644 --- a/schedule_duration.go +++ b/schedule_duration.go @@ -6,7 +6,7 @@ import ( "github.com/goexl/gox" "github.com/goexl/gox/field" "github.com/goexl/gox/rand" - "github.com/goexl/simaqian" + "github.com/goexl/log" "github.com/robfig/cron/v3" ) @@ -15,10 +15,10 @@ var _ cron.Schedule = (*scheduleDuration)(nil) type scheduleDuration struct { params *addParams self *durationParams - logger simaqian.Logger + logger log.Logger } -func newScheduleDuration(params *addParams, self *durationParams, logger simaqian.Logger) *scheduleDuration { +func newScheduleDuration(params *addParams, self *durationParams, logger log.Logger) *scheduleDuration { return &scheduleDuration{ params: params, self: self, diff --git a/schedule_time.go b/schedule_time.go index eb92f3e..2a6e235 100644 --- a/schedule_time.go +++ b/schedule_time.go @@ -6,7 +6,7 @@ import ( "github.com/goexl/gox" "github.com/goexl/gox/field" "github.com/goexl/gox/rand" - "github.com/goexl/simaqian" + "github.com/goexl/log" "github.com/robfig/cron/v3" ) @@ -15,10 +15,10 @@ var _ cron.Schedule = (*scheduleTime)(nil) type scheduleTime struct { params *addParams self *timeParams - logger simaqian.Logger + logger log.Logger } -func newScheduleTime(params *addParams, self *timeParams, logger simaqian.Logger) *scheduleTime { +func newScheduleTime(params *addParams, self *timeParams, logger log.Logger) *scheduleTime { return &scheduleTime{ params: params, self: self,