exercism/cpp/log-levels/log_levels.cpp

17 lines
338 B
C++
Raw Normal View History

2024-07-08 18:12:14 -04:00
#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