Minor logging speed up.

GitOrigin-RevId: a6c514665465d3527123a3847790a77e61ce534a
This commit is contained in:
levlam 2020-08-04 01:39:52 +03:00
parent d6b2fc0e17
commit 951e35e493

View File

@ -75,10 +75,10 @@ Logger::Logger(LogInterface &log, const LogOptions &options, int log_level, Slic
// timestamp
auto time = Clocks::system();
auto unix_time = static_cast<int32>(time);
auto nanoseconds = static_cast<int32>((time - unix_time) * 1e9);
auto unix_time = static_cast<uint32>(time);
auto nanoseconds = static_cast<uint32>((time - unix_time) * 1e9);
sb_ << '[' << unix_time << '.';
auto limit = 100000000;
uint32 limit = 100000000;
while (nanoseconds < limit && limit > 1) {
sb_ << '0';
limit /= 10;
@ -92,7 +92,7 @@ Logger::Logger(LogInterface &log, const LogOptions &options, int log_level, Slic
last_slash_--;
}
file_name = file_name.substr(last_slash_ + 1);
sb_ << '[' << file_name << ':' << line_num << ']';
sb_ << '[' << file_name << ':' << static_cast<unsigned int>(line_num) << ']';
}
// context from tag_