// CodeToLevel translate grpc response code into log level (info/debug/warning/error)
185116
func CodeToLevel(code codes.Code) log.Level {
	switch code {
	case codes.OK:
		return log.InfoLevel
	case codes.Canceled:
		fallthrough
	case codes.Unknown:
		fallthrough
	case codes.InvalidArgument:
		fallthrough
	case codes.DeadlineExceeded:
		fallthrough
	case codes.NotFound:
		fallthrough
	case codes.AlreadyExists:
		fallthrough
	case codes.PermissionDenied:
		fallthrough
	case codes.Unauthenticated:
		fallthrough
	case codes.ResourceExhausted:
		fallthrough
	case codes.FailedPrecondition:
		fallthrough
	case codes.Aborted:
		fallthrough
	case codes.OutOfRange:
		fallthrough
	case codes.Unimplemented:
		fallthrough
	case codes.Internal:
		fallthrough
	case codes.Unavailable:
		fallthrough
	case codes.DataLoss:
		return log.ErrorLevel
	default:
		return log.InfoLevel
	}
}
272209
func convertLevel(l Level) logging.Level {
	switch l {
	case DEBUG:
		return logging.DEBUG
	case WARNING:
		return logging.WARNING
	case ERROR:
		return logging.ERROR
	case FATAL:
		return logging.CRITICAL
	default:
		return logging.INFO
	}
}
472144
func NameToLevel(level string) zapcore.Level {
	l, err := nameToLevel(level)
	if err != nil {
		return zapcore.InfoLevel
	}
	return l
}
280134
func ProcessGRPCtoOCI(grpcProcess *Process) (*specs.Process, error) {
	s := &specs.Process{}

	err := copyStruct(s, grpcProcess)

	return s, err
}
829078
func (c *Client) ErrorWithLevel(level string, err error) {
	c.ErrorWithExtras(level, err, noExtras)
}
468722
func keyForLevel(addrKey [addrKeySize]byte, level uint8) [levelKeySize]byte {
	var key [levelKeySize]byte
	copy(key[:], addrKey[:])
	key[levelOffset] = level
	return key
}
523042
func CheckLevel(level string) error {
	if _, err := log.ParseLevel(level); err != nil {
		return fmt.Errorf(`log level not valid: "%s"`, level)
	}
	return nil
}
442020
func (l *LoggerLevels) DefaultLevel() zapcore.Level {
	l.mutex.RLock()
	lvl := l.defaultLevel
	l.mutex.RUnlock()
	return lvl
}
1360478
func (writer *ConsoleWriter) SetLevel(level LevelType) {
	writer.lock.Lock()
	defer writer.lock.Unlock()

	writer.blog.SetLevel(level)
}
346520
func PNGCompressionLevel(level png.CompressionLevel) EncodeOption {
	return func(c *encodeConfig) {
		c.pngCompressionLevel = level
	}
}
937855
func ParseLogLevel(level string) LogLevel {
	switch strings.ToLower(level) {
	case "debug":
		return DebugLevel
	case "info":
		return InfoLevel
	case "warn", "warning":
		return WarnLevel
	case "error":
		return ErrorLevel
	case "fatal":
		return FatalLevel
	case "panic":
		return PanicLevel
	default:
		return InfoLevel
	}
}
935593
func levelToJPrio(zLevel string) journal.Priority {
	lvl, _ := zerolog.ParseLevel(zLevel)

	switch lvl {
	case zerolog.DebugLevel:
		return journal.PriDebug
	case zerolog.InfoLevel:
		return journal.PriInfo
	case zerolog.WarnLevel:
		return journal.PriWarning
	case zerolog.ErrorLevel:
		return journal.PriErr
	case zerolog.FatalLevel:
		return journal.PriCrit
	case zerolog.PanicLevel:
		return journal.PriEmerg
	case zerolog.NoLevel:
		return journal.PriNotice
	}
	return defaultJournalDPrio
}
253761
func LoggerSetLevel(ctx context.Context, levelStr string) context.Context {
	logger := loggerFromContext(ctx)

	levelStr = strings.ToLower(levelStr)

	if levelStr == "debug" {
		logger.inDebug = true
	} else {
		logger.inDebug = false
	}

	level, err := log.LvlFromString(levelStr)
	if err != nil {
		Die("Cannot find log level : " + levelStr)
	}
	leveledBackend := log.LvlFilterHandler(level, logger.handler)
	logger.logger.SetHandler(leveledBackend)
	ctx = context.WithValue(ctx, LoggerKey, logger)
	return ctx
}
1325556
func (l *Slog) ErrorLevel() *Slog {
	l = l.copy()
	l.Log.Priority = ErrorPrio
	return l
}
679432
func (logger *Logger) GetLevel() logging.LogLevel {
	unsafeStd := (*unsafe.Pointer)(unsafe.Pointer(&logger.std))
	stdVal := (*lg.Logger)(atomic.LoadPointer(unsafeStd))
	l := stdVal.Level
	switch l {
	case lg.PanicLevel:
		return logging.PanicLevel
	case lg.FatalLevel:
		return logging.FatalLevel
	case lg.ErrorLevel:
		return logging.ErrorLevel
	case lg.WarnLevel:
		return logging.WarnLevel
	case lg.InfoLevel:
		return logging.InfoLevel
	case lg.DebugLevel:
		return logging.DebugLevel
	default:
		return logging.DebugLevel
	}
}
34485
func SetLogLevel(level string) {
	switch strings.ToLower(level) {
	case "debug":
		log.SetLevel(log.DebugLevel)
	case "info":
		log.SetLevel(log.InfoLevel)
	case "warn":
		log.SetLevel(log.WarnLevel)
	case "error":
		log.SetLevel(log.ErrorLevel)
	default:
		log.Fatalf("Unknown level: %s", level)
	}
}
878941
func LogLevels(levels map[string]logging.Level) Option {
	return func(r *Ringpop) error {
		return logging.SetLevels(levels)
	}
}