No need to verify log levels
This commit is contained in:
parent
df36995213
commit
a136509522
|
@ -615,9 +615,6 @@ func setupLogLevel(debug bool, l string) error {
|
||||||
return errors.New("log level not in expected format \"identifier:loglevel\" or \"loglevel\"")
|
return errors.New("log level not in expected format \"identifier:loglevel\" or \"loglevel\"")
|
||||||
}
|
}
|
||||||
|
|
||||||
if !ipfscluster.IsLogLevel(lvl) {
|
|
||||||
return fmt.Errorf("%s is not a valid log level", lvl)
|
|
||||||
}
|
|
||||||
_, ok := compLogFacs[comp]
|
_, ok := compLogFacs[comp]
|
||||||
if ok {
|
if ok {
|
||||||
fmt.Printf("overwriting existing %s log level\n", comp)
|
fmt.Printf("overwriting existing %s log level\n", comp)
|
||||||
|
|
13
logging.go
13
logging.go
|
@ -1,8 +1,6 @@
|
||||||
package ipfscluster
|
package ipfscluster
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
|
||||||
|
|
||||||
logging "github.com/ipfs/go-log"
|
logging "github.com/ipfs/go-log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -70,14 +68,3 @@ func SetFacilityLogLevel(f, l string) {
|
||||||
*/
|
*/
|
||||||
logging.SetLogLevel(f, l)
|
logging.SetLogLevel(f, l)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsLogLevel checks if given string is a valid log level.
|
|
||||||
func IsLogLevel(s string) bool {
|
|
||||||
for _, level := range []string{"DEBUG", "CRITICAL", "ERROR", "WARNING", "NOTICE", "INFO"} {
|
|
||||||
if strings.ToUpper(s) == level {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user