Skip to content

Commit f6faf0c

Browse files
committed
[lldb] Add new Swift log channel
1 parent b068ac5 commit f6faf0c

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

lldb/include/lldb/Utility/Logging.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
LIBLLDB_LOG_STATE | LIBLLDB_LOG_SYMBOLS | LIBLLDB_LOG_TARGET | \
5151
LIBLLDB_LOG_COMMANDS)
5252

53+
#define LIBLLDB_SWIFT_LOG_HEALTH (1u << 1)
54+
5355
namespace lldb_private {
5456

5557
class Log;
@@ -58,6 +60,8 @@ Log *GetLogIfAllCategoriesSet(uint32_t mask);
5860

5961
Log *GetLogIfAnyCategoriesSet(uint32_t mask);
6062

63+
Log *GetSwiftHealthLog();
64+
6165
void InitializeLldbChannel();
6266

6367
} // namespace lldb_private

lldb/source/Utility/Logging.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,16 @@ static constexpr Log::Category g_categories[] = {
4949
{{"watch"}, {"log watchpoint related activities"}, LIBLLDB_LOG_WATCHPOINTS},
5050
};
5151

52+
static constexpr Log::Category g_swift_categories[] = {
53+
{{"health"}, {"log all messages related to lldb Swift operational health"}, LIBLLDB_SWIFT_LOG_HEALTH},
54+
};
55+
5256
static Log::Channel g_log_channel(g_categories, LIBLLDB_LOG_DEFAULT);
57+
static Log::Channel g_swift_log_channel(g_swift_categories, LIBLLDB_SWIFT_LOG_HEALTH);
5358

5459
void lldb_private::InitializeLldbChannel() {
5560
Log::Register("lldb", g_log_channel);
61+
Log::Register("swift", g_swift_log_channel);
5662
}
5763

5864
Log *lldb_private::GetLogIfAllCategoriesSet(uint32_t mask) {
@@ -62,3 +68,7 @@ Log *lldb_private::GetLogIfAllCategoriesSet(uint32_t mask) {
6268
Log *lldb_private::GetLogIfAnyCategoriesSet(uint32_t mask) {
6369
return g_log_channel.GetLogIfAny(mask);
6470
}
71+
72+
Log *lldb_private::GetSwiftHealthLog() {
73+
return g_swift_log_channel.GetLogIfAny(LIBLLDB_SWIFT_LOG_HEALTH);
74+
}

0 commit comments

Comments
 (0)