MCPcopy
hub / github.com/spacecloud-io/space-cloud / SetLogLevel

Function SetLogLevel

space-cli/cmd/utils/log.go:39–52  ·  view source on GitHub ↗

SetLogLevel sets a single verbosity level for log messages.

(loglevel string)

Source from the content-addressed store, hash-verified

37
38// SetLogLevel sets a single verbosity level for log messages.
39func SetLogLevel(loglevel string) {
40 switch loglevel {
41 case "debug":
42 logrus.SetLevel(logrus.DebugLevel)
43 case "info":
44 logrus.SetLevel(logrus.InfoLevel)
45 case "error":
46 logrus.SetLevel(logrus.ErrorLevel)
47 default:
48 _ = LogError(fmt.Sprintf("Invalid log level (%s) provided", loglevel), nil)
49 LogInfo("Defaulting to `info` level")
50 logrus.SetLevel(logrus.InfoLevel)
51 }
52}

Callers 1

TestSetLogLevelFunction · 0.85

Calls 2

LogErrorFunction · 0.85
LogInfoFunction · 0.85

Tested by 1

TestSetLogLevelFunction · 0.68