mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-23 04:03:49 +00:00
0be3044b7e
* rename * rename "make grpc" * rename "abi bindings templates" * rename "abi bindings templates"
40 lines
677 B
Go
40 lines
677 B
Go
package snapshotsync
|
|
|
|
import (
|
|
lg "github.com/anacrolix/log"
|
|
"github.com/ledgerwatch/erigon/log"
|
|
)
|
|
|
|
func init() {
|
|
lg.Default = NewAdapterLogger()
|
|
}
|
|
func NewAdapterLogger() lg.Logger {
|
|
return lg.Logger{
|
|
LoggerImpl: lg.LoggerImpl(adapterLogger{}),
|
|
}
|
|
}
|
|
|
|
type adapterLogger struct{}
|
|
|
|
func (b adapterLogger) Log(msg lg.Msg) {
|
|
lvl, ok := msg.GetLevel()
|
|
if !ok {
|
|
lvl = lg.Info
|
|
}
|
|
|
|
switch lvl {
|
|
case lg.Debug:
|
|
log.Info(msg.String())
|
|
case lg.Info:
|
|
log.Info(msg.String())
|
|
case lg.Warning:
|
|
log.Warn(msg.String())
|
|
case lg.Error:
|
|
log.Error(msg.String())
|
|
case lg.Critical:
|
|
log.Error(msg.String())
|
|
default:
|
|
log.Warn("unknown log type", "msg", msg.String())
|
|
}
|
|
}
|