xiaoxiang781216 commented on code in PR #21128:
URL: https://github.com/apache/nuttx/pull/21128#discussion_r4431340007


##########
libs/libc/syslog/lib_syslog.c:
##########
@@ -27,12 +27,89 @@
 #include <nuttx/config.h>
 
 #include <stdarg.h>
+#include <stdio.h>
 #include <syslog.h>
+#include <unistd.h>
 
 #include <nuttx/syslog/syslog.h>
+#include <nuttx/tls.h>
 
 #include "syslog/syslog.h"
 
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* A message of a program: the OS adds the ident of openlog() */
+
+#ifdef __KERNEL__
+#  define VSYSLOG_FLAGS 0
+#else
+#  define VSYSLOG_FLAGS SYSLOG_OPENLOG
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+#if !defined(__KERNEL__) && defined(va_copy)
+/****************************************************************************
+ * Name: vsyslog_perror
+ *
+ * Description:
+ *   With LOG_PERROR of openlog(), write the message to stderr too, with the
+ *   ident and the process ID before it and a newline after it.
+ *
+ ****************************************************************************/
+
+static void vsyslog_perror(FAR const IPTR char *fmt, va_list ap)
+{
+  FAR struct task_info_s *info = task_get_info();
+  FAR const IPTR char *end;
+  va_list copy;
+  int option;
+
+  if (info == NULL
+#ifdef CONFIG_BUILD_FLAT
+      || up_interrupt_context()
+#endif
+     )
+    {
+      return;
+    }
+
+  option = info->ta_openlog.ol_option;
+  if ((option & LOG_PERROR) == 0)

Review Comment:
   but is it fine to add additional info to stderr or make stderr mirror the 
syslog output?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to