
This mostly aims to document how everything was generated, and the steps necessary to re-generate the same files verbatim; the goal is to figure out how to reproduce the files as they currently are. The exception is that we strip out the timestamp out of install.sh.
34 lines
980 B
Go
34 lines
980 B
Go
package logutils
|
|
|
|
//go:generate mockgen -package logutils -source log.go -destination log_mock.go
|
|
//go:generate goimports -w log_mock.go
|
|
|
|
type Log interface {
|
|
Fatalf(format string, args ...interface{})
|
|
Errorf(format string, args ...interface{})
|
|
Warnf(format string, args ...interface{})
|
|
Infof(format string, args ...interface{})
|
|
|
|
Child(name string) Log
|
|
SetLevel(level LogLevel)
|
|
}
|
|
|
|
type LogLevel int
|
|
|
|
const (
|
|
// debug message, write to debug logs only by logutils.Debug
|
|
LogLevelDebug LogLevel = 0
|
|
|
|
// information messages, don't write too much messages,
|
|
// only useful ones: they are shown when running with -v
|
|
LogLevelInfo LogLevel = 1
|
|
|
|
// hidden errors: non critical errors: work can be continued, no need to fail whole program;
|
|
// tests will crash if any warning occurred.
|
|
LogLevelWarn LogLevel = 2
|
|
|
|
// only not hidden from user errors: whole program failing, usually
|
|
// error logging happens in 1-2 places: in the "main" function.
|
|
LogLevelError LogLevel = 3
|
|
)
|