Make Logger an interface, so external logger can be used, closes #52

This commit is contained in:
Eugene Dementiev 2015-10-04 22:30:03 +03:00
parent 05d326f717
commit 8dfe0aa72f
1 changed files with 13 additions and 1 deletions

14
tail.go
View File

@ -39,6 +39,18 @@ type SeekInfo struct {
Whence int // os.SEEK_* Whence int // os.SEEK_*
} }
type logger interface {
Fatal(v ...interface{})
Fatalf(format string, v ...interface{})
Fatalln(v ...interface{})
Panic(v ...interface{})
Panicf(format string, v ...interface{})
Panicln(v ...interface{})
Print(v ...interface{})
Printf(format string, v ...interface{})
Println(v ...interface{})
}
// Config is used to specify how a file must be tailed. // Config is used to specify how a file must be tailed.
type Config struct { type Config struct {
// File-specifc // File-specifc
@ -54,7 +66,7 @@ type Config struct {
// Logger, when nil, is set to tail.DefaultLogger // Logger, when nil, is set to tail.DefaultLogger
// To disable logging: set field to tail.DiscardingLogger // To disable logging: set field to tail.DiscardingLogger
Logger *log.Logger Logger logger
} }
type Tail struct { type Tail struct {