llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)

<details>
<summary>Changes</summary>

Currently, calls to Host::SystemLog print to stderr on all host platforms 
except Darwin. This severely limits its value on the command line, where we 
don't want to overload the user with log messages. Switch to using the syslog 
function on POSIX systems to send messages to the system logger instead of 
stdout.

On Darwin systems this sends the log message to os_log, which matches what we 
do today. Nevertheless I kept the current implementation that uses os_log 
directly as it gives us more freedom.

I'm not sure if there's an equivalent on Windows, so I kept the existing 
behavior of logging to stderr.

---
Full diff: https://github.com/llvm/llvm-project/pull/83366.diff


1 Files Affected:

- (modified) lldb/source/Host/common/Host.cpp (+9) 


``````````diff
diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp
index f4cec97f5af633..1af01ef5025bc4 100644
--- a/lldb/source/Host/common/Host.cpp
+++ b/lldb/source/Host/common/Host.cpp
@@ -89,8 +89,17 @@ using namespace lldb;
 using namespace lldb_private;
 
 #if !defined(__APPLE__)
+#if !defined(_WIN32)
+#include <syslog.h>
+void Host::SystemLog(llvm::StringRef message) {
+  openlog("lldb", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_USER);
+  syslog(LOG_INFO, "%s", message.data());
+  closelog();
+}
+#else
 void Host::SystemLog(llvm::StringRef message) { llvm::errs() << message; }
 #endif
+#endif
 
 #if !defined(__APPLE__) && !defined(_WIN32)
 static thread_result_t

``````````

</details>


https://github.com/llvm/llvm-project/pull/83366
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to