From d0e905babe601b325d6314fdd8fe637004585a8b Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Tue, 15 Feb 2022 19:38:33 +0100 Subject: [PATCH] Fix critical log level The CRITICAL log level no longer exists and we were logging more than we wanted to. --- ipfscluster_test.go | 2 +- logging.go | 24 ++++++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/ipfscluster_test.go b/ipfscluster_test.go index cf52b41d..69943c68 100644 --- a/ipfscluster_test.go +++ b/ipfscluster_test.go @@ -54,7 +54,7 @@ var ( // number of pins to pin/unpin/check nPins = 100 - logLevel = "CRITICAL" + logLevel = "FATAL" customLogLvlFacilities = logFacilities{} consensus = "crdt" diff --git a/logging.go b/logging.go index f60daeec..9e39bc91 100644 --- a/logging.go +++ b/logging.go @@ -36,9 +36,9 @@ var LoggingFacilities = map[string]string{ // used in ipfs-cluster dependencies, which may be useful // to display. Along with their default value. var LoggingFacilitiesExtra = map[string]string{ - "p2p-gorpc": "CRITICAL", + "p2p-gorpc": "FATAL", "swarm2": "ERROR", - "libp2p-raft": "CRITICAL", + "libp2p-raft": "FATAL", "raftlib": "ERROR", "badger": "INFO", } @@ -46,12 +46,20 @@ var LoggingFacilitiesExtra = map[string]string{ // SetFacilityLogLevel sets the log level for a given module func SetFacilityLogLevel(f, l string) { /* - CRITICAL Level = iota - ERROR - WARNING - NOTICE - INFO - DEBUG + 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 */ logging.SetLogLevel(f, l) }