converter static method

LogLevel converter(
  1. String name
)

Converts a string name to its corresponding LogLevel enum value.

Throws a StateError if no matching level is found, ensuring that only valid log levels are used.

name - The name of the log level to convert. Returns the LogLevel value matching the name.

Implementation

static LogLevel converter(String name) => LogLevel.values
        .firstWhere((logLevel) => logLevel.name == name, orElse: () {
      throw StateError('Invalid log level name: $name');
    });