ipfs-cluster/logging.go
Hector Sanjuan 6447ea51d2 Remove *Serial types. Use pointers for all types.
This takes advantange of the latest features in go-cid, peer.ID and
go-multiaddr and makes the Go types serializable by default.

This means we no longer need to copy between Pin <-> PinSerial, or ID <->
IDSerial etc. We can now efficiently binary-encode these types using short
field keys and without parsing/stringifying (in many cases it just a cast).

We still get the same json output as before (with minor modifications for
Cids).

This should greatly improve Cluster performance and memory usage when dealing
with large collections of items.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2019-02-27 17:04:35 +00:00

51 lines
1.2 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",
"ipfsproxy": "INFO",
"ipfshttp": "INFO",
"monitor": "INFO",
"mapstate": "INFO",
"dsstate": "INFO",
"consensus": "INFO",
"pintracker": "INFO",
"ascendalloc": "INFO",
"diskinfo": "INFO",
"apitypes": "INFO",
"config": "INFO",
"shardingdags": "INFO",
"localdags": "INFO",
"adder": "INFO",
"optracker": "INFO",
}
// LoggingFacilitiesExtra provides logging identifiers
// used in ipfs-cluster dependencies, which may be useful
// 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)
}