未验证 提交 92508bcc 编写于 作者: T Tlincy 提交者: GitHub

Update LogUtils.cpp: use switch ... case to replace if ... else

Signed-off-by: YUANING0369's avatarTlincy <540549770@qq.com>
上级 44e8e020
......@@ -54,27 +54,31 @@ RolloutHandler(const char* filename, std::size_t size, el::Level level) {
int ret;
std::string m(std::string(dir) + "/" + s);
s = m;
if (level == el::Level::Global) {
s.append("." + std::to_string(++global_idx));
ret = rename(m.c_str(), s.c_str());
} else if (level == el::Level::Debug) {
switch(level){
case el::Level::Debug:
s.append("." + std::to_string(++debug_idx));
ret = rename(m.c_str(), s.c_str());
} else if (level == el::Level::Warning) {
break;
case el::Level::Warning:
s.append("." + std::to_string(++warning_idx));
ret = rename(m.c_str(), s.c_str());
} else if (level == el::Level::Trace) {
break;
case el::Level::Trace:
s.append("." + std::to_string(++trace_idx));
ret = rename(m.c_str(), s.c_str());
} else if (level == el::Level::Error) {
break;
case el::Level::Error:
s.append("." + std::to_string(++error_idx));
ret = rename(m.c_str(), s.c_str());
} else if (level == el::Level::Fatal) {
break;
case el::Level::Fatal:
s.append("." + std::to_string(++fatal_idx));
ret = rename(m.c_str(), s.c_str());
} else {
break;
default:
s.append("." + std::to_string(++global_idx));
ret = rename(m.c_str(), s.c_str());
break;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册