From 8dfe0aa72f79040b8ca6981d967cc3989ad3f574 Mon Sep 17 00:00:00 2001 From: Eugene Dementiev Date: Sun, 4 Oct 2015 22:30:03 +0300 Subject: [PATCH] Make Logger an interface, so external logger can be used, closes #52 --- tail.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tail.go b/tail.go index a7a1a5b..e7bff9b 100644 --- a/tail.go +++ b/tail.go @@ -39,6 +39,18 @@ type SeekInfo struct { 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. type Config struct { // File-specifc @@ -54,7 +66,7 @@ type Config struct { // Logger, when nil, is set to tail.DefaultLogger // To disable logging: set field to tail.DiscardingLogger - Logger *log.Logger + Logger logger } type Tail struct {