Skip to content

Commit

Permalink
logger interface
Browse files Browse the repository at this point in the history
  • Loading branch information
daheige committed May 23, 2020
1 parent 7afc51f commit 343c9db
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func NewTask(fn func() error) *Task {
}

// run exec a task.
func (t *Task) run(logEntry logger) {
func (t *Task) run(logEntry Logger) {
if t == nil {
return
}
Expand All @@ -37,8 +37,8 @@ func (t *Task) run(logEntry logger) {
t.fn()
}

// logger log record interface
type logger interface {
// Logger log record interface
type Logger interface {
Println(args ...interface{})
}

Expand All @@ -47,7 +47,7 @@ type Pool struct {
entryChan chan *Task // task entry chan
jobChan chan *Task // job chan
workerNum int // worker num
logEntry logger // logger interface
logEntry Logger // logger interface
stop chan struct{} // stop sem
interrupt chan os.Signal // interrupt signal
wait time.Duration // close entry chan wait time,default 5s
Expand Down Expand Up @@ -124,7 +124,7 @@ func NewPool(num int, ec int, jc ...int) *Pool {
}

// WithLogger change logger entry.
func WithLogger(logEntry logger) Option {
func WithLogger(logEntry Logger) Option {
return func(p *Pool) {
p.logEntry = logEntry
}
Expand Down

0 comments on commit 343c9db

Please sign in to comment.