2017-01-30 12:12:25 +00:00
|
|
|
package ipfscluster
|
|
|
|
|
2019-12-04 17:40:35 +00:00
|
|
|
import (
|
2020-03-13 20:40:02 +00:00
|
|
|
logging "github.com/ipfs/go-log/v2"
|
2019-12-04 17:40:35 +00:00
|
|
|
)
|
2017-01-30 12:12:25 +00:00
|
|
|
|
|
|
|
var logger = logging.Logger("cluster")
|
2017-03-10 16:24:25 +00:00
|
|
|
|
2018-01-11 17:09:10 +00:00
|
|
|
// LoggingFacilities provides a list of logging identifiers
|
|
|
|
// used by cluster and their default logging level.
|
|
|
|
var LoggingFacilities = map[string]string{
|
2018-08-07 18:01:02 +00:00
|
|
|
"cluster": "INFO",
|
|
|
|
"restapi": "INFO",
|
2019-08-29 15:19:53 +00:00
|
|
|
"restapilog": "INFO",
|
2018-10-14 17:12:50 +00:00
|
|
|
"ipfsproxy": "INFO",
|
2019-09-10 06:59:03 +00:00
|
|
|
"ipfsproxylog": "INFO",
|
2018-08-07 18:01:02 +00:00
|
|
|
"ipfshttp": "INFO",
|
|
|
|
"monitor": "INFO",
|
2019-02-27 17:04:35 +00:00
|
|
|
"dsstate": "INFO",
|
2019-02-20 14:24:25 +00:00
|
|
|
"raft": "INFO",
|
|
|
|
"crdt": "INFO",
|
2018-08-07 18:01:02 +00:00
|
|
|
"pintracker": "INFO",
|
|
|
|
"diskinfo": "INFO",
|
2021-09-13 12:13:32 +00:00
|
|
|
"tags": "INFO",
|
2018-08-07 18:01:02 +00:00
|
|
|
"apitypes": "INFO",
|
|
|
|
"config": "INFO",
|
|
|
|
"shardingdags": "INFO",
|
2019-09-21 08:37:26 +00:00
|
|
|
"singledags": "INFO",
|
2018-08-07 18:01:02 +00:00
|
|
|
"adder": "INFO",
|
2018-08-14 17:57:14 +00:00
|
|
|
"optracker": "INFO",
|
2019-06-09 11:26:18 +00:00
|
|
|
"pstoremgr": "INFO",
|
2021-10-06 12:10:06 +00:00
|
|
|
"allocator": "INFO",
|
2018-01-11 17:09:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// LoggingFacilitiesExtra provides logging identifiers
|
|
|
|
// used in ipfs-cluster dependencies, which may be useful
|
2018-01-15 09:49:07 +00:00
|
|
|
// to display. Along with their default value.
|
2018-01-11 17:09:10 +00:00
|
|
|
var LoggingFacilitiesExtra = map[string]string{
|
2022-02-15 18:38:33 +00:00
|
|
|
"p2p-gorpc": "FATAL",
|
2018-01-11 17:09:10 +00:00
|
|
|
"swarm2": "ERROR",
|
2022-02-15 18:38:33 +00:00
|
|
|
"libp2p-raft": "FATAL",
|
2019-02-20 14:24:25 +00:00
|
|
|
"raftlib": "ERROR",
|
2021-08-06 08:26:28 +00:00
|
|
|
"badger": "INFO",
|
2017-03-10 16:24:25 +00:00
|
|
|
}
|
2017-01-30 12:12:25 +00:00
|
|
|
|
2017-02-02 22:52:06 +00:00
|
|
|
// SetFacilityLogLevel sets the log level for a given module
|
|
|
|
func SetFacilityLogLevel(f, l string) {
|
2017-01-30 12:12:25 +00:00
|
|
|
/*
|
2022-02-15 18:38:33 +00:00
|
|
|
case "debug", "DEBUG":
|
|
|
|
*l = DebugLevel
|
|
|
|
case "info", "INFO", "": // make the zero value useful
|
|
|
|
*l = InfoLevel
|
|
|
|
case "warn", "WARN":
|
|
|
|
*l = WarnLevel
|
|
|
|
case "error", "ERROR":
|
|
|
|
*l = ErrorLevel
|
|
|
|
case "dpanic", "DPANIC":
|
|
|
|
*l = DPanicLevel
|
|
|
|
case "panic", "PANIC":
|
|
|
|
*l = PanicLevel
|
|
|
|
case "fatal", "FATAL":
|
|
|
|
*l = FatalLevel
|
2017-01-30 12:12:25 +00:00
|
|
|
*/
|
2017-02-02 22:52:06 +00:00
|
|
|
logging.SetLogLevel(f, l)
|
2017-01-30 12:12:25 +00:00
|
|
|
}
|