Skip to content

Commit

Permalink
refactor(日志): 使用goexl/log
Browse files Browse the repository at this point in the history
  • Loading branch information
storezhang committed Oct 25, 2023
1 parent 5ed55e8 commit 7782af1
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 24 deletions.
4 changes: 2 additions & 2 deletions builder.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package schedule

import (
"github.com/goexl/simaqian"
"github.com/goexl/log"
)

type builder struct {
Expand All @@ -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
Expand Down
10 changes: 3 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -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
)
Expand All @@ -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
)
6 changes: 3 additions & 3 deletions job_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ 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"
)

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,
Expand Down
6 changes: 3 additions & 3 deletions job_once.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ package schedule
import (
"github.com/goexl/gox"
"github.com/goexl/gox/field"
"github.com/goexl/simaqian"
"github.com/goexl/log"
)

type jobOnce struct {
id *string
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,
Expand Down
6 changes: 3 additions & 3 deletions params.go
Original file line number Diff line number Diff line change
@@ -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 &params{
logger: simaqian.Default(),
logger: log.New().Apply(),
}
}
6 changes: 3 additions & 3 deletions schedule_duration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions schedule_time.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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,
Expand Down

0 comments on commit 7782af1

Please sign in to comment.