[Lldb-commits] [lldb] cc13d4f - [lldb] Make the system log a NOOP on non-Darwin platforms

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 15 16:13:48 PDT 2024


Author: Jonas Devlieghere
Date: 2024-10-15T16:13:42-07:00
New Revision: cc13d4fb4a208363ed1dab29829cd200a3e39c52

URL: https://github.com/llvm/llvm-project/commit/cc13d4fb4a208363ed1dab29829cd200a3e39c52
DIFF: https://github.com/llvm/llvm-project/commit/cc13d4fb4a208363ed1dab29829cd200a3e39c52.diff

LOG: [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.

Added: 
    

Modified: 
    lldb/source/Host/common/Host.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp
index 6857a29b039902..03ea2f242d3c78 100644
--- a/lldb/source/Host/common/Host.cpp
+++ b/lldb/source/Host/common/Host.cpp
@@ -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}};


        


More information about the lldb-commits mailing list