[Lldb-commits] [lldb] [lldb-dap] show a useful timestamp in log messages (PR #170737)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Thu Dec 4 16:09:45 PST 2025
================
@@ -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();
----------------
JDevlieghere wrote:
I've never seen anyone define a lock_guard as const, so it look a bit weird in that context, but then on the other hand I see why you're making it consistent with the const below. I don't think there's a good solution so happy to go with your preference, and just wanted to call it out.
https://github.com/llvm/llvm-project/pull/170737
More information about the lldb-commits
mailing list