mirror of
https://codeberg.org/andyscott/exercism.git
synced 2024-11-13 23:00:47 -05:00
17 lines
338 B
C++
17 lines
338 B
C++
|
#include <string>
|
||
|
|
||
|
namespace log_line {
|
||
|
std::string message(std::string line) {
|
||
|
return line.substr(line.find(" ") + 1);
|
||
|
}
|
||
|
|
||
|
std::string log_level(std::string line) {
|
||
|
return line.substr(1, line.find("]") - 1);
|
||
|
}
|
||
|
|
||
|
std::string reformat(std::string line) {
|
||
|
|
||
|
return message(line) + " (" + log_level(line) + ")";
|
||
|
}
|
||
|
} // namespace log_line
|