class LogLevelExtractor {

  public static Result extract(String logLine) {
    Matcher m = LOG_PATTERN.matcher(logLine);
    if (!m.find()) {
      return null;
    }

    String logLevel = m.group(1);
    String logTimestamp = m.group(2) + SPACE + m.group(3) + SPACE + m.group(4);

    LocalDateTime timestamp = LocalDateTime.parse(logTimestamp, LOG_TIMESTAMP_FORMATTER);

    return new Result(logLevel, timestamp);
  }

}