2021-06-18 18:45:29 +00:00
|
|
|
package kit
|
2021-06-11 17:26:25 +00:00
|
|
|
|
|
|
|
import (
|
2023-01-19 11:49:07 +00:00
|
|
|
"io"
|
|
|
|
"log"
|
|
|
|
|
2021-06-11 17:26:25 +00:00
|
|
|
logging "github.com/ipfs/go-log/v2"
|
2022-06-14 15:00:51 +00:00
|
|
|
|
|
|
|
"github.com/filecoin-project/lotus/lib/lotuslog"
|
2021-06-11 17:26:25 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func QuietMiningLogs() {
|
|
|
|
lotuslog.SetupLogLevels()
|
|
|
|
|
2021-06-14 17:58:40 +00:00
|
|
|
_ = logging.SetLogLevel("miner", "ERROR") // set this to INFO to watch mining happen.
|
2021-06-11 17:26:25 +00:00
|
|
|
_ = logging.SetLogLevel("chainstore", "ERROR")
|
|
|
|
_ = logging.SetLogLevel("chain", "ERROR")
|
|
|
|
_ = logging.SetLogLevel("sub", "ERROR")
|
2022-12-15 06:05:54 +00:00
|
|
|
_ = logging.SetLogLevel("wdpost", "ERROR")
|
2021-06-11 17:26:25 +00:00
|
|
|
_ = logging.SetLogLevel("storageminer", "ERROR")
|
|
|
|
_ = logging.SetLogLevel("pubsub", "ERROR")
|
|
|
|
_ = logging.SetLogLevel("gen", "ERROR")
|
2022-03-16 16:33:05 +00:00
|
|
|
_ = logging.SetLogLevel("rpc", "ERROR")
|
2023-09-21 15:37:02 +00:00
|
|
|
_ = logging.SetLogLevel("consensus-common", "ERROR")
|
2021-06-11 17:26:25 +00:00
|
|
|
_ = logging.SetLogLevel("dht/RtRefreshManager", "ERROR")
|
|
|
|
}
|
2023-01-19 11:49:07 +00:00
|
|
|
|
|
|
|
func QuietAllLogsExcept(names ...string) {
|
|
|
|
log.SetOutput(io.Discard) // suppress LogDatastore messages
|
|
|
|
|
|
|
|
lotuslog.SetupLogLevels()
|
|
|
|
logging.SetAllLoggers(logging.LevelError)
|
|
|
|
for _, name := range names {
|
|
|
|
_ = logging.SetLogLevel(name, "INFO")
|
|
|
|
}
|
|
|
|
}
|