Skip to content

Commit cc13d4f

Browse files
committed
[lldb] Make the system log a NOOP on non-Darwin platforms
As discussed in #111911, we have consensus that as it stands, the system log is only meaningful on Darwin and that by default it should be a NOOP on other platforms.
1 parent 08ed199 commit cc13d4f

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

lldb/source/Host/common/Host.cpp

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -90,30 +90,12 @@ using namespace lldb;
9090
using namespace lldb_private;
9191

9292
#if !defined(__APPLE__)
93-
#if !defined(_WIN32)
94-
#include <syslog.h>
95-
void Host::SystemLog(Severity severity, llvm::StringRef message) {
96-
static llvm::once_flag g_openlog_once;
97-
llvm::call_once(g_openlog_once,
98-
[] { openlog("lldb", LOG_PID | LOG_NDELAY, LOG_USER); });
99-
int level = LOG_DEBUG;
100-
switch (severity) {
101-
case lldb::eSeverityInfo:
102-
level = LOG_INFO;
103-
break;
104-
case lldb::eSeverityWarning:
105-
level = LOG_WARNING;
106-
break;
107-
case lldb::eSeverityError:
108-
level = LOG_ERR;
109-
break;
110-
}
111-
syslog(level, "%s", message.data());
112-
}
113-
#else
93+
// The system log is currently only meaningful on Darwin, where this means
94+
// os_log. The meaning of a "system log" isn't as clear on other platforms, and
95+
// therefore we don't providate a default implementation. Vendors are free to
96+
// to implement this function if they have a use for it.
11497
void Host::SystemLog(Severity severity, llvm::StringRef message) {}
11598
#endif
116-
#endif
11799

118100
static constexpr Log::Category g_categories[] = {
119101
{{"system"}, {"system log"}, SystemLog::System}};

0 commit comments

Comments
 (0)