status-go/logutils/logger.go

28 lines
442 B
Go
Raw Normal View History

2019-07-17 22:25:42 +00:00
package logutils
import (
"sync"
"go.uber.org/zap"
2019-07-17 22:25:42 +00:00
"github.com/ethereum/go-ethereum/log"
)
var (
_zapLogger *zap.Logger
_initZapLogger sync.Once
)
// ZapLogger creates a custom zap.Logger which will forward logs
// to status-go logger.
func ZapLogger() *zap.Logger {
_initZapLogger.Do(func() {
var err error
2023-11-09 06:35:59 +00:00
_zapLogger, err = NewZapLoggerWithAdapter(log.Root())
if err != nil {
panic(err)
}
})
return _zapLogger
}