本文整理汇总了C++中LogMessage::getTimeStr方法的典型用法代码示例。如果您正苦于以下问题:C++ LogMessage::getTimeStr方法的具体用法?C++ LogMessage::getTimeStr怎么用?C++ LogMessage::getTimeStr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogMessage
的用法示例。
在下文中一共展示了LogMessage::getTimeStr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: write
void Appender::write(LogMessage& message)
{
if (!level || level > message.level)
return;
message.prefix.clear();
if (flags & APPENDER_FLAGS_PREFIX_TIMESTAMP)
message.prefix.append(message.getTimeStr());
if (flags & APPENDER_FLAGS_PREFIX_LOGLEVEL)
{
if (!message.prefix.empty())
message.prefix.push_back(' ');
char text[MAX_QUERY_LEN];
snprintf(text, MAX_QUERY_LEN, "%-5s", Appender::getLogLevelString(message.level));
message.prefix.append(text);
}
if (flags & APPENDER_FLAGS_PREFIX_LOGFILTERTYPE)
{
if (!message.prefix.empty())
message.prefix.push_back(' ');
message.prefix.push_back('[');
message.prefix.append(message.type);
message.prefix.push_back(']');
}
if (!message.prefix.empty())
message.prefix.push_back(' ');
_write(message);
}
示例2: write
void Appender::write(LogMessage& message)
{
if (!level || level > message.level)
{
//fprintf(stderr, "Appender::write: Appender %s, Level %s. Msg %s Level %s Type %s WRONG LEVEL MASK\n", getName().c_str(), getLogLevelString(level), message.text.c_str(), getLogLevelString(message.level), getLogFilterTypeString(message.type)); // DEBUG - RemoveMe
return;
}
message.prefix.clear();
if (flags & APPENDER_FLAGS_PREFIX_TIMESTAMP)
message.prefix.append(message.getTimeStr().c_str());
if (flags & APPENDER_FLAGS_PREFIX_LOGLEVEL)
{
if (!message.prefix.empty())
message.prefix.push_back(' ');
char text[MAX_QUERY_LEN];
snprintf(text, MAX_QUERY_LEN, "%-5s", Appender::getLogLevelString(message.level));
message.prefix.append(text);
}
if (flags & APPENDER_FLAGS_PREFIX_LOGFILTERTYPE)
{
if (!message.prefix.empty())
message.prefix.push_back(' ');
char text[MAX_QUERY_LEN];
snprintf(text, MAX_QUERY_LEN, "[%s]", Appender::getLogFilterTypeString(message.type));
message.prefix.append(text);
}
if (!message.prefix.empty())
message.prefix.push_back(' ');
_write(message);
}