Gary-Hobson commented on code in PR #8012:
URL: https://github.com/apache/nuttx/pull/8012#discussion_r1061635337


##########
drivers/syslog/vsyslog.c:
##########
@@ -140,72 +142,118 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, 
FAR va_list *ap)
     }
 
 #  if defined(CONFIG_SYSLOG_TIMESTAMP_FORMATTED)
-  d_ret = strftime(date_buf, CONFIG_SYSLOG_TIMESTAMP_BUFFER,
-                   CONFIG_SYSLOG_TIMESTAMP_FORMAT, &tm);
+  date_buf[0] = '\0';
+  strftime(date_buf, CONFIG_SYSLOG_TIMESTAMP_BUFFER,
+           CONFIG_SYSLOG_TIMESTAMP_FORMAT, &tm);
 #  endif
 #endif
 
+  ret = lib_sprintf(&stream.public,
 #if defined(CONFIG_SYSLOG_COLOR_OUTPUT)
   /* Reset the terminal style. */
 
-  ret = lib_sprintf(&stream.public, "\e[0m");
+                    "\e[0m"
 #endif
 
 #ifdef CONFIG_SYSLOG_TIMESTAMP
 #  if defined(CONFIG_SYSLOG_TIMESTAMP_FORMATTED)
 #    if defined(CONFIG_SYSLOG_TIMESTAMP_FORMAT_MICROSECOND)
-  ret += lib_sprintf(&stream.public, "[%*s.%06ld] ",
-                    d_ret, date_buf, ts.tv_nsec / NSEC_PER_USEC);
+                    "[%s.%06ld] "
 #    else
-  ret += lib_sprintf(&stream.public, "[%*s] ", d_ret, date_buf);
+                    "[%s] "
 #    endif
 #  else
-  ret += lib_sprintf(&stream.public, "[%5jd.%06ld] ",
-                    (uintmax_t)ts.tv_sec, ts.tv_nsec / NSEC_PER_USEC);
+    "[%5jd.%06ld] "
 #  endif
 #endif
 
 #if defined(CONFIG_SMP)
-  ret += lib_sprintf(&stream.public, "[CPU%d] ", up_cpu_index());
+                    "[CPU%d] "
 #endif
 
 #if defined(CONFIG_SYSLOG_PROCESSID)
   /* Prepend the Thread ID */
 
-  ret += lib_sprintf(&stream.public, "[%2d] ", gettid());
+                    "[%2d] "
 #endif
 
 #if defined(CONFIG_SYSLOG_COLOR_OUTPUT)
   /* Set the terminal style according to message priority. */
 
-  ret += lib_sprintf(&stream.public, "%s", g_priority_color[priority]);
+                    "%s"
 #endif
 
 #if defined(CONFIG_SYSLOG_PRIORITY)
   /* Prepend the message priority. */
 
-  ret += lib_sprintf(&stream.public, "[%6s] ", g_priority_str[priority]);
+                    "[%6s] "
 #endif
 
 #if defined(CONFIG_SYSLOG_PREFIX)
   /* Prepend the prefix, if available */
 
-  ret += lib_sprintf(&stream.public, "[%s] ", CONFIG_SYSLOG_PREFIX_STRING);
+                    "[%s] "
+#endif
+#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_SYSLOG_PROCESS_NAME)
+  /* Prepend the thread name */
+
+                    "%s: "
+#endif
+  "%pV"

Review Comment:
   done



##########
drivers/syslog/vsyslog.c:
##########
@@ -140,72 +142,118 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, 
FAR va_list *ap)
     }
 
 #  if defined(CONFIG_SYSLOG_TIMESTAMP_FORMATTED)
-  d_ret = strftime(date_buf, CONFIG_SYSLOG_TIMESTAMP_BUFFER,
-                   CONFIG_SYSLOG_TIMESTAMP_FORMAT, &tm);
+  date_buf[0] = '\0';
+  strftime(date_buf, CONFIG_SYSLOG_TIMESTAMP_BUFFER,
+           CONFIG_SYSLOG_TIMESTAMP_FORMAT, &tm);
 #  endif
 #endif
 
+  ret = lib_sprintf(&stream.public,
 #if defined(CONFIG_SYSLOG_COLOR_OUTPUT)
   /* Reset the terminal style. */
 
-  ret = lib_sprintf(&stream.public, "\e[0m");
+                    "\e[0m"
 #endif
 
 #ifdef CONFIG_SYSLOG_TIMESTAMP
 #  if defined(CONFIG_SYSLOG_TIMESTAMP_FORMATTED)
 #    if defined(CONFIG_SYSLOG_TIMESTAMP_FORMAT_MICROSECOND)
-  ret += lib_sprintf(&stream.public, "[%*s.%06ld] ",
-                    d_ret, date_buf, ts.tv_nsec / NSEC_PER_USEC);
+                    "[%s.%06ld] "
 #    else
-  ret += lib_sprintf(&stream.public, "[%*s] ", d_ret, date_buf);
+                    "[%s] "
 #    endif
 #  else
-  ret += lib_sprintf(&stream.public, "[%5jd.%06ld] ",
-                    (uintmax_t)ts.tv_sec, ts.tv_nsec / NSEC_PER_USEC);
+    "[%5jd.%06ld] "

Review Comment:
   done



-- 
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: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to