1
0
mirror of https://github.com/danog/gojekyll.git synced 2024-11-30 10:29:02 +01:00
gojekyll/commands/logging.go
2017-07-19 16:06:43 -04:00

29 lines
563 B
Go

package commands
import (
"fmt"
"github.com/osteele/gojekyll/utils"
)
type bannerLogger struct{ labelWidth int }
var logger = bannerLogger{}
func (l *bannerLogger) Info(a ...interface{}) {
fmt.Println(a...)
}
func (l *bannerLogger) label(label string, msg string, a ...interface{}) {
if len(label) > l.labelWidth {
l.labelWidth = len(label)
}
if !quiet {
fmt.Printf("%s %s\n", utils.LeftPad(label, l.labelWidth), fmt.Sprintf(msg, a...))
}
}
func (l *bannerLogger) path(label string, filename string) {
l.label(label, utils.MustAbs(filename))
}