When logging timestamps for log messages, log to millisecond precision

This commit is contained in:
Eric Frias 2015-08-25 17:30:21 -04:00
parent f6a675681e
commit 9f2a1e8b0c

View file

@ -153,7 +153,11 @@ namespace fc {
{
std::stringstream line;
//line << (m.get_context().get_timestamp().time_since_epoch().count() % (1000ll*1000ll*60ll*60))/1000 <<"ms ";
line << string(m.get_context().get_timestamp()) << " ";
//line << string(m.get_context().get_timestamp()) << " ";
time_point timestamp = m.get_context().get_timestamp();
line << string(timestamp);
uint64_t milliseconds = (timestamp.time_since_epoch().count() % 1000000) / 1000;
line << "." << std::setw(3) << std::setfill('0') << milliseconds << " ";
line << std::setw( 21 ) << (m.get_context().get_thread_name().substr(0,9) + string(":") + m.get_context().get_task_name()).c_str() << " ";
string method_name = m.get_context().get_method();