31 lines
456 B
Go
31 lines
456 B
Go
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...)
|
|
}
|
|
}
|