[Lldb-commits] [lldb] [lldb-dap] show a useful timestamp in log messages (PR #170737)
via lldb-commits
lldb-commits at lists.llvm.org
Thu Dec 4 12:27:38 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Ebuka Ezike (da-viper)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/170737.diff
1 Files Affected:
- (modified) lldb/tools/lldb-dap/DAPLog.cpp (+4-4)
``````````diff
diff --git a/lldb/tools/lldb-dap/DAPLog.cpp b/lldb/tools/lldb-dap/DAPLog.cpp
index f66784e197518..5b1d650a87241 100644
--- a/lldb/tools/lldb-dap/DAPLog.cpp
+++ b/lldb/tools/lldb-dap/DAPLog.cpp
@@ -8,6 +8,7 @@
#include "DAPLog.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Chrono.h"
#include "llvm/Support/raw_ostream.h"
#include <chrono>
#include <mutex>
@@ -20,10 +21,9 @@ namespace lldb_dap {
Log::Log(StringRef filename, std::error_code &EC) : m_stream(filename, EC) {}
void Log::WriteMessage(StringRef message) {
- std::lock_guard<std::mutex> lock(m_mutex);
- std::chrono::duration<double> now{
- std::chrono::system_clock::now().time_since_epoch()};
- m_stream << formatv("{0:f9} ", now.count()).str() << message << "\n";
+ const std::lock_guard<std::mutex> lock(m_mutex);
+ const llvm::sys::TimePoint<> time = std::chrono::system_clock::now();
+ m_stream << formatv("[{0:%H:%M:%S.%L}] ", time) << message << '\n';
m_stream.flush();
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/170737
More information about the lldb-commits
mailing list