Log: delimit thread name in log message
authorPavel Labath <labath@google.com>
Wed, 8 Nov 2017 10:48:54 +0000 (10:48 +0000)
committerPavel Labath <labath@google.com>
Wed, 8 Nov 2017 10:48:54 +0000 (10:48 +0000)
The thread name was not followed by a space, which meant it was glued to
the log message. I also align the name as we do that with other log
fields. I align it to 16 chars instead of llvm::max_thread_name(), as
that can be 64 on darwin, which is rather long. If anybody feels
differently about that, we can change it.

llvm-svn: 317679

lldb/source/Utility/Log.cpp

index 78050db..f247124 100644 (file)
@@ -287,8 +287,7 @@ void Log::WriteHeader(llvm::raw_ostream &OS, llvm::StringRef file,
   if (options.Test(LLDB_LOG_OPTION_PREPEND_THREAD_NAME)) {
     llvm::SmallString<32> thread_name;
     llvm::get_thread_name(thread_name);
-    if (!thread_name.empty())
-      OS << thread_name;
+    OS << llvm::formatv("{0,-16} ", thread_name);
   }
 
   if (options.Test(LLDB_LOG_OPTION_BACKTRACE))