mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-26 13:59:45 +00:00
6e1436cefb
Signed-off-by: Evan Lezar <elezar@nvidia.com>
18 lines
364 B
Go
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
|
|
}
|
|
}
|