Skip to content

Commit

Permalink
[lldb] Make the system log a NOOP on non-Darwin platforms
Browse files Browse the repository at this point in the history
As discussed in llvm#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.
  • Loading branch information
JDevlieghere committed Oct 15, 2024
1 parent 08ed199 commit cc13d4f
Showing 1 changed file with 4 additions and 22 deletions.
26 changes: 4 additions & 22 deletions lldb/source/Host/common/Host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,30 +90,12 @@ using namespace lldb;
using namespace lldb_private;

#if !defined(__APPLE__)
#if !defined(_WIN32)
#include <syslog.h>
void Host::SystemLog(Severity severity, llvm::StringRef message) {
static llvm::once_flag g_openlog_once;
llvm::call_once(g_openlog_once,
[] { openlog("lldb", LOG_PID | LOG_NDELAY, LOG_USER); });
int level = LOG_DEBUG;
switch (severity) {
case lldb::eSeverityInfo:
level = LOG_INFO;
break;
case lldb::eSeverityWarning:
level = LOG_WARNING;
break;
case lldb::eSeverityError:
level = LOG_ERR;
break;
}
syslog(level, "%s", message.data());
}
#else
// The system log is currently only meaningful on Darwin, where this means
// os_log. The meaning of a "system log" isn't as clear on other platforms, and
// therefore we don't providate a default implementation. Vendors are free to
// to implement this function if they have a use for it.
void Host::SystemLog(Severity severity, llvm::StringRef message) {}
#endif
#endif

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

0 comments on commit cc13d4f

Please sign in to comment.