2a6f91cd35
This puts some sanity in this. It's not super correct (name of facilities depend of the component and the main cluster component should not hard code them), but it's clear enough. Imho, better than over-engineering a more elegant approach. License: MIT Signed-off-by: Hector Sanjuan <code@hector.link>
45 lines
1.0 KiB
Go
45 lines
1.0 KiB
Go
package ipfscluster
|
|
|
|
import logging "github.com/ipfs/go-log"
|
|
|
|
var logger = logging.Logger("cluster")
|
|
|
|
// LoggingFacilities provides a list of logging identifiers
|
|
// used by cluster and their default logging level.
|
|
var LoggingFacilities = map[string]string{
|
|
"cluster": "INFO",
|
|
"restapi": "INFO",
|
|
"ipfshttp": "INFO",
|
|
"monitor": "INFO",
|
|
"mapstate": "INFO",
|
|
"consensus": "INFO",
|
|
"pintracker": "INFO",
|
|
"ascendalloc": "INFO",
|
|
"diskinfo": "INFO",
|
|
"apitypes": "INFO",
|
|
"config": "INFO",
|
|
}
|
|
|
|
// LoggingFacilitiesExtra provides logging identifiers
|
|
// used in ipfs-cluster dependencies, which may be useful
|
|
// for to display. Along with their default value.
|
|
var LoggingFacilitiesExtra = map[string]string{
|
|
"p2p-gorpc": "CRITICAL",
|
|
"swarm2": "ERROR",
|
|
"libp2p-raft": "CRITICAL",
|
|
"raft": "ERROR",
|
|
}
|
|
|
|
// SetFacilityLogLevel sets the log level for a given module
|
|
func SetFacilityLogLevel(f, l string) {
|
|
/*
|
|
CRITICAL Level = iota
|
|
ERROR
|
|
WARNING
|
|
NOTICE
|
|
INFO
|
|
DEBUG
|
|
*/
|
|
logging.SetLogLevel(f, l)
|
|
}
|