castor/logger/logger.go

31 lines
456 B
Go
Raw Normal View History

2020-09-16 19:17:54 +00:00
package logger
2020-09-12 20:30:41 +00:00
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 {
2020-09-12 20:30:41 +00:00
return &l{
debug: debug,
2020-09-12 20:30:41 +00:00
}
}
type l struct {
debug bool
2020-09-12 20:30:41 +00:00
}
func (l *l) Info(s ...interface{}) {
log.Println(s...)
2020-09-12 20:30:41 +00:00
}
func (l *l) Debug(s ...interface{}) {
if l.debug {
log.Println(s...)
2020-09-12 20:30:41 +00:00
}
}