std::shared_ptr<utils::FileLogBackend> history_logger =
std::shared_ptr<utils::FileLogBackend>(new utils::FileLogBackend(
kHistoryFileName, kLogRotationSize, kLogMaximumRotation));
- std::string history = "pkgid:" + context_->pkgid.get() + "|mode:" +
- GetRequestTypeString(context_->request_type.get());
- history += "|START";
+ std::string history = context_->pkgid.get() + "|" +
+ GetRequestTypeString(context_->request_type.get()) + "|START";
history_logger->WriteLog(::utils::LogLevel::LOG_INFO, "", history);
history_logger->WriteLogToFile();
}
std::shared_ptr<utils::FileLogBackend> history_logger =
std::shared_ptr<utils::FileLogBackend>(new utils::FileLogBackend(
kHistoryFileName, kLogRotationSize, kLogMaximumRotation));
- std::string history = "pkgid:" + context_->pkgid.get() + "|mode:" +
+ std::string history = context_->pkgid.get() + "|" +
GetRequestTypeString(context_->request_type.get());
if (success)
history += "|SUCCESS";
time_t seconds = ts.tv_sec;
struct tm gmt;
if (!gmtime_r(&seconds, &gmt))
- return "[]";
+ return "|";
int32_t miliseconds = ts.tv_nsec / 1000000;
char buf[32];
- strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", &gmt);
+ strftime(buf, sizeof(buf), "%Y%m%d.%H%M%S", &gmt);
char timestamp[32];
- snprintf(timestamp, sizeof(timestamp), "[%s.%03d UTC]", buf, miliseconds);
+ snprintf(timestamp, sizeof(timestamp), "%s.%03dUTC|", buf, miliseconds);
return timestamp;
}
std::string FileLogBackend::GetPid() {
- return "[" + std::to_string(getpid()) + "]";
+ return std::to_string(getpid()) + "|";
}
} // namespace utils