split out logger into proper package
This commit is contained in:
30
logger/logger.go
Normal file
30
logger/logger.go
Normal 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...)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user