Minor logging speed improvement.

GitOrigin-RevId: b09db1051a11e477f20bfb35fd9a37c9173a8c2a
This commit is contained in:
levlam 2020-08-04 01:07:49 +03:00
parent 4a0eeb5792
commit 4cbc6035e7
1 changed files with 10 additions and 6 deletions

View File

@ -56,18 +56,22 @@ Logger::Logger(LogInterface &log, const LogOptions &options, int log_level, Slic
// log level
sb_ << '[';
if (log_level < 10) {
sb_ << ' ';
if (static_cast<unsigned int>(log_level) < 10) {
sb_ << ' ' << static_cast<char>('0' + log_level);
} else {
sb_ << log_level;
}
sb_ << log_level << ']';
sb_ << ']';
// thread id
auto thread_id = get_thread_id();
sb_ << "[t";
if (thread_id < 10) {
sb_ << ' ';
if (static_cast<unsigned int>(thread_id) < 10) {
sb_ << ' ' << static_cast<char>('0' + thread_id);
} else {
sb_ << thread_id;
}
sb_ << thread_id << ']';
sb_ << ']';
// timestamp
auto time = Clocks::system();