Skip to content

Commit f827e4d

Browse files
authored
[lldb-dap] show a useful timestamp in log messages (#170737)
It becomes easier to see the time difference between requests and responses
1 parent b36f89f commit f827e4d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lldb/tools/lldb-dap/DAPLog.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include "DAPLog.h"
1010
#include "llvm/ADT/StringRef.h"
11+
#include "llvm/Support/Chrono.h"
1112
#include "llvm/Support/raw_ostream.h"
1213
#include <chrono>
1314
#include <mutex>
@@ -21,9 +22,8 @@ Log::Log(StringRef filename, std::error_code &EC) : m_stream(filename, EC) {}
2122

2223
void Log::WriteMessage(StringRef message) {
2324
std::lock_guard<std::mutex> lock(m_mutex);
24-
std::chrono::duration<double> now{
25-
std::chrono::system_clock::now().time_since_epoch()};
26-
m_stream << formatv("{0:f9} ", now.count()).str() << message << "\n";
25+
const llvm::sys::TimePoint<> time = std::chrono::system_clock::now();
26+
m_stream << formatv("[{0:%H:%M:%S.%L}] ", time) << message << '\n';
2727
m_stream.flush();
2828
}
2929

0 commit comments

Comments
 (0)