Skip to content

Commit 2db66e8

Browse files
committed
[lldb] Auto-enable swift health logging to memory buffer
1 parent 09506be commit 2db66e8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lldb/source/Utility/Logging.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,19 @@ static constexpr Log::Category g_swift_categories[] = {
5959

6060
static Log::Channel g_swift_log_channel(g_swift_categories, LIBLLDB_SWIFT_LOG_HEALTH);
6161

62+
static std::string g_swift_log_buffer;
63+
6264
#endif
6365

6466
void lldb_private::InitializeLldbChannel() {
6567
Log::Register("lldb", g_log_channel);
6668
#ifdef LLDB_ENABLE_SWIFT
6769
Log::Register("swift", g_swift_log_channel);
70+
71+
llvm::raw_null_ostream error_stream;
72+
Log::EnableLogChannel(
73+
std::make_shared<llvm::raw_string_ostream>(g_swift_log_buffer),
74+
LLDB_LOG_OPTION_THREADSAFE, "swift", {"health"}, error_stream);
6875
#endif
6976
}
7077

0 commit comments

Comments
 (0)