1
0
mirror of https://github.com/danog/gojekyll.git synced 2024-11-27 13:34:49 +01:00
gojekyll/cmd/logging.go
2017-07-13 19:02:30 -04:00

29 lines
558 B
Go

package cmd
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))
}