split out logger into proper package

This commit is contained in:
2020-09-16 15:17:54 -04:00
parent 87b909a31c
commit b2d6756605
3 changed files with 11 additions and 9 deletions

30
logger/logger.go Normal file
View File

@@ -0,0 +1,30 @@
package logger
import "log"
// Logger has just two levels: info and debug
type Logger interface {
Info(...interface{})
Debug(...interface{})
}
// NewLogger returns a logger that has just two levels: info and debug
func NewLogger(debug bool) Logger {
return &l{
debug: debug,
}
}
type l struct {
debug bool
}
func (l *l) Info(s ...interface{}) {
log.Println(s...)
}
func (l *l) Debug(s ...interface{}) {
if l.debug {
log.Println(s...)
}
}