nvidia-container-toolkit/vendor/github.com/tsaikd/KDGoLib/logrusutil/stack.go
Evan Lezar 6e1436cefb Update go vendoring
Signed-off-by: Evan Lezar <elezar@nvidia.com>
2021-09-07 13:13:03 +02:00

18 lines
364 B
Go

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
}
}