goc/pkg/log/ci_logger.go

54 lines
1.1 KiB
Go
Raw Normal View History

2021-04-04 03:42:05 +00:00
package log
import "go.uber.org/zap"
type ciLogger struct {
logger *zap.Logger
}
func newCiLogger() *ciLogger {
logger, _ := zap.NewDevelopment()
2021-04-19 02:18:37 +00:00
// fix: increases the number of caller from always reporting the wrapper code as caller
logger = logger.WithOptions(zap.AddCallerSkip(2))
2021-04-04 03:42:05 +00:00
zap.ReplaceGlobals(logger)
return &ciLogger{
logger: logger,
}
}
func (c *ciLogger) StartWait(message string) {
}
func (c *ciLogger) StopWait() {
}
func (c *ciLogger) Sync() {
c.logger.Sync()
}
func (c *ciLogger) Debugf(format string, args ...interface{}) {
zap.S().Debugf(format, args...)
}
func (c *ciLogger) Donef(format string, args ...interface{}) {
zap.S().Infof(format, args...)
}
func (c *ciLogger) Infof(format string, args ...interface{}) {
zap.S().Infof(format, args...)
}
func (c *ciLogger) Errorf(format string, args ...interface{}) {
zap.S().Errorf(format, args...)
}
func (c *ciLogger) Warnf(format string, args ...interface{}) {
zap.S().Warnf(format, args...)
}
func (c *ciLogger) Fatalf(format string, args ...interface{}) {
zap.S().Fatalf(format, args...)
}