Skip to content

Log Levels: feedback incorrectly recommends to use the substring method #150

@santhoshswamyv

Description

@santhoshswamyv

Issue in Log Levels Exercise

I used the substring method to solve the exercise but the automated feedback insists me to use substring. Resolve this issue as soon as possible.

image

class LogLevels {

	public static String message(String logLine) {
		logLine = logLine.substring(logLine.indexOf(":") + 1);
		return logLine.trim();
	}

	public static String logLevel(String logLine) {
		if (logLine.toLowerCase().contains("info"))
			return "info";
		if (logLine.toLowerCase().contains("warning"))
			return "warning";

		return "error";
	}

	public static String reformat(String logLine) {
		return message(logLine) + " (" + logLevel(logLine) + ")";
	}
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions