erigon-pulse/turbo/snapshotsync/bittorrent/logger.go
b00ris 6464da7670
Remote snapshot downloader (#1343)
* save state

* save state

* save state

* refactoring

* fix

* save state

* save state

* fmt

* fix lint

* restore torrents for external downloader

* fix lint

* download

* skip debug test

* debug

* remote debug

* small cli fixes

* skip debug test

* external snapshot predownloader

* get rid of remote downloader

* fix lint

* clean makefile

* fix lint

* fix lint

* cleanup

* fix ci

* fmt

* remove proto from interfaces

* Squashed 'interfaces/' content from commit acd02bb94

git-subtree-dir: interfaces
git-subtree-split: acd02bb94c5a421aa8f8d1fd76cd8aad668e9fcb
2020-11-13 16:16:47 +00:00

40 lines
668 B
Go

package bittorrent
import (
lg "github.com/anacrolix/log"
"github.com/ledgerwatch/turbo-geth/log"
)
func init() {
lg.Default = NewAdapterLogger()
}
func NewAdapterLogger() lg.Logger {
return lg.Logger{
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.Debug(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())
}
}