nvidia-container-toolkit/vendor/github.com/tsaikd/KDGoLib/logrusutil/stack.go

18 lines
364 B
Go
Raw Normal View History

package logrusutil
import "github.com/sirupsen/logrus"
// StackLogLevel temporary change log level and return recover function
func StackLogLevel(logger *logrus.Logger, level logrus.Level) (recover func()) {
if logger.Level == level {
return func() {}
}
originLevel := logger.Level
logger.Level = level
return func() {
logger.Level = originLevel
}
}