[Lldb-commits] [lldb] r317679 - Log: delimit thread name in log message

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 8 02:48:54 PST 2017


Author: labath
Date: Wed Nov  8 02:48:54 2017
New Revision: 317679

URL: http://llvm.org/viewvc/llvm-project?rev=317679&view=rev
Log:
Log: delimit thread name in log message

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.

Modified:
    lldb/trunk/source/Utility/Log.cpp

Modified: lldb/trunk/source/Utility/Log.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Log.cpp?rev=317679&r1=317678&r2=317679&view=diff
==============================================================================
--- lldb/trunk/source/Utility/Log.cpp (original)
+++ lldb/trunk/source/Utility/Log.cpp Wed Nov  8 02:48:54 2017
@@ -287,8 +287,7 @@ void Log::WriteHeader(llvm::raw_ostream
   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))




More information about the lldb-commits mailing list