
1. 去掉全局的配置 config 2. 合并 pkg/build, pkg/flag, pkg/cover, pkg/config 几个包(这几个包有强相关性,适合放一处。并且分开也容易造成循环依赖)
54 lines
800 B
Go
54 lines
800 B
Go
package log
|
|
|
|
import (
|
|
"go.uber.org/zap/zapcore"
|
|
)
|
|
|
|
var g Logger
|
|
|
|
func NewLogger(debug bool) {
|
|
if debug == true {
|
|
g = newCiLogger()
|
|
} else {
|
|
g = &terminalLogger{
|
|
level: zapcore.InfoLevel,
|
|
}
|
|
}
|
|
}
|
|
|
|
func Debugf(format string, args ...interface{}) {
|
|
g.Debugf(format, args...)
|
|
}
|
|
|
|
func Donef(format string, args ...interface{}) {
|
|
g.Donef(format, args...)
|
|
}
|
|
|
|
func Infof(format string, args ...interface{}) {
|
|
g.Infof(format, args...)
|
|
}
|
|
|
|
func Warnf(format string, args ...interface{}) {
|
|
g.Warnf(format, args...)
|
|
}
|
|
|
|
func Fatalf(format string, args ...interface{}) {
|
|
g.Fatalf(format, args...)
|
|
}
|
|
|
|
func Errorf(format string, args ...interface{}) {
|
|
g.Errorf(format, args...)
|
|
}
|
|
|
|
func StartWait(message string) {
|
|
g.StartWait(message)
|
|
}
|
|
|
|
func StopWait() {
|
|
g.StopWait()
|
|
}
|
|
|
|
func Sync() {
|
|
g.Sync()
|
|
}
|