fromValue static method

LogStep fromValue(
  1. String value
)

Converts a string value to its corresponding LogStep.

This method is case-insensitive and throws an InvalidArgumentException if the input string does not match any valid LogStep.

Example

final step = LogStep.fromValue("timestamp");

Implementation

static LogStep fromValue(String value) {
  switch (value.toLowerCase()) {
    case "timestamp":
      return TIMESTAMP;
    case "date":
      return DATE;
    case "level":
      return LEVEL;
    case "tag":
      return TAG;
    case "thread":
      return THREAD;
    case "location":
      return LOCATION;
    case "message":
      return MESSAGE;
    case "error":
      return ERROR;
    case "stacktrace":
      return STACKTRACE;
    default:
      throw InvalidArgumentException("Invalid LogStep value: $value. Available values: ${LogStep.values.map((e) => e.name).join(", ")}");
  }
}