ipfs-cluster/logging.go
Hector Sanjuan 6a243df4da api: Support /ws/ and /dns/ multiaddresses parsing. Log all errors
The multiaddresses protocols for websockets and dns are only registered
with init() function when loading the modules. ipfs-cluster-ctl
uses just the api, which did not load these modules so converting
from serialized types caused bad panics.

We have also ignored errors in the api library under the thinking that it
would only parse things serialized by us, but this has made parsing errors
to go unnoticed. From now, all errors are logged and some precautions
are taking to better handle the possibility of nil objects.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-12-08 01:05:49 +01:00

33 lines
478 B
Go

package ipfscluster
import logging "github.com/ipfs/go-log"
var logger = logging.Logger("cluster")
var facilities = []string{
"cluster",
"restapi",
"ipfshttp",
"monitor",
"mapstate",
"consensus",
"raft",
"pintracker",
"ascendalloc",
"diskinfo",
"apitypes",
}
// 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)
}