Prechádzať zdrojové kódy

Merge pull request #161 from liu-xuewen/master

change log to interface
Rob Figueiredo 6 rokov pred
rodič
commit
61d93e07d1
2 zmenil súbory, kde vykonal 7 pridanie a 1 odobranie
  1. 1 0
      .gitignore
  2. 6 1
      cron.go

+ 1 - 0
.gitignore

@@ -20,3 +20,4 @@ _cgo_export.*
 _testmain.go
 
 *.exe
+.idea/

+ 6 - 1
cron.go

@@ -16,7 +16,7 @@ type Cron struct {
 	add      chan *Entry
 	snapshot chan []*Entry
 	running  bool
-	ErrorLog *log.Logger
+	ErrorLog Logger
 	location *time.Location
 }
 
@@ -32,6 +32,11 @@ type Schedule interface {
 	Next(time.Time) time.Time
 }
 
+// Logger is a Logger interface.
+type Logger interface {
+	Printf(format string, v ...interface{})
+}
+
 // Entry consists of a schedule and the func to execute on that schedule.
 type Entry struct {
 	// The schedule on which this job should be run.