本文整理汇总了C++中TimeStamp::log方法的典型用法代码示例。如果您正苦于以下问题:C++ TimeStamp::log方法的具体用法?C++ TimeStamp::log怎么用?C++ TimeStamp::log使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeStamp
的用法示例。
在下文中一共展示了TimeStamp::log方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int, char **, char **) {
Print printf(Platform::instance().output());
CommonEra ce;
ce.fromNow();
ce.show();
LocalTime lt;
lt.fromCommonEra(ce);
lt.show();
TimeStamp ts;
printf("UTC iso8601: %s\n", ts.iso8601(ce));
printf("UTC milspec: %s\n", ts.milspec(ce));
printf("UTC civilian: %s\n", ts.civilian(ce));
printf("UTC log: %s\n", ts.log(ce));
printf("UTC formal: %s\n", ts.formal(ce));
printf("UTC highprecision: %s\n", ts.highprecision(ce));
printf("LCT iso8601: %s\n", ts.iso8601(lt));
printf("LCT milspec: %s\n", ts.milspec(lt));
printf("LCT civilian: %s\n", ts.civilian(lt));
printf("LCT log: %s\n", ts.log(lt));
printf("LCT formal: %s\n", ts.formal(lt));
printf("LCT highprecision: %s\n", ts.highprecision(lt));
std::exit(0);
}
示例2: format
//
// Format the log string with a prefix into the provided buffer.
//
ssize_t Logger::format(
char* buffer,
size_t size,
Level level,
const char* format,
va_list ap
) {
TimeStamp timestamp;
const char* stamp = timestamp.log();
if (!((0 <= level) &&
(static_cast<size_t>(level) < countof(this->labels)))) {
level = Logger::PRINT;
}
int octets = ::snprintf(buffer, size, "[%x]%s [%4.4s] ",
level, stamp, this->labels[level]);
int rc = ::vsnprintf(buffer + octets, size - octets, format, ap);
return octets + rc;
}