本文整理汇总了C++中LogRecord::getLogMessage方法的典型用法代码示例。如果您正苦于以下问题:C++ LogRecord::getLogMessage方法的具体用法?C++ LogRecord::getLogMessage怎么用?C++ LogRecord::getLogMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogRecord
的用法示例。
在下文中一共展示了LogRecord::getLogMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addLogDetails
am_status_t LogService::addLogDetails(const std::string& logName,
const LogRecord& record,
const std::string& loggedByTokenID)
{
ScopeLock scopeLock(mLock);
char logLevel[32];
am_status_t status = AM_SUCCESS;
char *msg = NULL;
std::string message = record.getLogMessage();
//The encoded log message needs to be in multiple of 4 bytes.
msg = (char *)malloc(((message.size() * 4/3 + 1)/4+1)*4 + 4);
if(msg != NULL) {
encode_base64(message.c_str(), message.size(), msg);
} else {
status = AM_NO_MEMORY;
}
if (status == AM_SUCCESS) {
if(!remoteBodyChunkListInitialized) {
const std::size_t NUM_EXTRA_CHUNKS = 50;
remoteRequest = new Request(*this, requestPrefixChunk,
logRequestPrefixChunk, NUM_EXTRA_CHUNKS);
if (remoteRequest != NULL) {
remoteBodyChunkList = remoteRequest->getBodyChunkList();
remoteBodyChunkListInitialized = true;
}
}
if(bufferCount >= 1) {
remoteBodyChunkList.push_back(additionalRequestPrefixChunk);
BodyChunk temp;
char serviceIdBuf[1024];
if (remoteRequest != NULL) {
remoteRequest->getNextServiceRequestIdAsString(
serviceIdBuf, sizeof(serviceIdBuf));
}
temp.data = serviceIdBuf;
remoteBodyChunkList.push_back(temp);
}
sprintf(logLevel, "%d", record.getLogLevel());
remoteBodyChunkList.push_back(logLogPrefixChunk);
remoteBodyChunkList.push_back(BodyChunk(logName));
remoteBodyChunkList.push_back(logSidPrefixChunk);
remoteBodyChunkList.push_back(BodyChunk(loggedByTokenID));
remoteBodyChunkList.push_back(logLogSuffixChunk);
remoteBodyChunkList.push_back(logRecordPrefixChunk);
remoteBodyChunkList.push_back(logLevelPrefixChunk);
remoteBodyChunkList.push_back(BodyChunk(std::string(logLevel)));
remoteBodyChunkList.push_back(logLevelSuffixChunk);
remoteBodyChunkList.push_back(logRecMsgPrefixChunk);
std::string t_mesg(msg);
free(msg);
Utils::expandEntityRefs(t_mesg);
remoteBodyChunkList.push_back(BodyChunk(t_mesg));
remoteBodyChunkList.push_back(logRecMsgSuffixChunk);
remoteBodyChunkList.push_back(logInfoMapPrefixChunk);
const Properties &properties = record.getLogInfo();
Properties::const_iterator iter = properties.begin();
for(; iter != properties.end(); iter++) {
const Properties::key_type &k_iter = iter->first;
const Properties::mapped_type &v_iter = iter->second;
std::string keyStr("");
keyStr = k_iter.c_str();
std::string valueStr("");
valueStr = v_iter.c_str();
remoteBodyChunkList.push_back(logInfoKeyPrefixChunk);
remoteBodyChunkList.push_back(BodyChunk(keyStr));
remoteBodyChunkList.push_back(logInfoKeySuffixChunk);
remoteBodyChunkList.push_back(logInfoValuePrefixChunk);
remoteBodyChunkList.push_back(BodyChunk(valueStr));
remoteBodyChunkList.push_back(logInfoValueSuffixChunk);
}
remoteBodyChunkList.push_back(logInfoMapSuffixChunk);
remoteBodyChunkList.push_back(logRecordSuffixChunk);
remoteBodyChunkList.push_back(requestSuffixChunk);
bufferCount++;
} else {
status = AM_NO_MEMORY;
}
return status;
}