In this exercise you'll be processing log-lines.
Each log line is a string formatted as follows: "[<LEVEL>]: <MESSAGE>".
There are three different log levels:
INFOWARNINGERRORYou have three tasks, each of which will take a log line and ask you to do something with it.
Implement the message function to return a log line's message:
julia> message("[ERROR]: Invalid operation")
"Invalid operation"Any leading or trailing white space should be removed:
julia> message("[WARNING]: Disk almost full\r\n")
"Disk almost full"Implement the log_level function to return a log line's log level, which should be returned in lowercase:
julia> log_level("[ERROR]: Invalid operation")
"error"Implement the reformat function that reformats the log line, putting the message first and the log level after it in parentheses:
julia> reformat("[INFO]: Operation completed")
"Operation completed (info)"Note: All strings in this exercise are in English and limited to the ASCII character set. Later Concepts will give a chance to work with Unicode characters.
In this exercise you'll be processing log-lines.
Each log line is a string formatted as follows: "[<LEVEL>]: <MESSAGE>".
There are three different log levels:
INFOWARNINGERRORYou have three tasks, each of which will take a log line and ask you to do something with it.
Implement the message function to return a log line's message:
julia> message("[ERROR]: Invalid operation")
"Invalid operation"Any leading or trailing white space should be removed:
julia> message("[WARNING]: Disk almost full\r\n")
"Disk almost full"Implement the log_level function to return a log line's log level, which should be returned in lowercase:
julia> log_level("[ERROR]: Invalid operation")
"error"Implement the reformat function that reformats the log line, putting the message first and the log level after it in parentheses:
julia> reformat("[INFO]: Operation completed")
"Operation completed (info)"Note: All strings in this exercise are in English and limited to the ASCII character set. Later Concepts will give a chance to work with Unicode characters.