You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/01/11 15:24:08 UTC

[GitHub] [incubator-nuttx] fjpanag commented on a change in pull request #2621: Added formatted timestamps in syslog.

fjpanag commented on a change in pull request #2621:
URL: https://github.com/apache/incubator-nuttx/pull/2621#discussion_r555123249



##########
File path: drivers/syslog/vsyslog.c
##########
@@ -132,8 +133,29 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap)
 #if defined(CONFIG_SYSLOG_TIMESTAMP)
   /* Pre-pend the message with the current time, if available */
 
+#if defined(CONFIG_SYSLOG_TIMESTAMP_FORMATED)
+  time_t time;
+  struct tm * tm;
+  char date_buf[CONFIG_SYSLOG_TIMESTAMP_BUFFER];

Review comment:
       Done.

##########
File path: drivers/syslog/vsyslog.c
##########
@@ -132,8 +133,29 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap)
 #if defined(CONFIG_SYSLOG_TIMESTAMP)
   /* Pre-pend the message with the current time, if available */
 
+#if defined(CONFIG_SYSLOG_TIMESTAMP_FORMATED)
+  time_t time;
+  struct tm * tm;
+  char date_buf[CONFIG_SYSLOG_TIMESTAMP_BUFFER];
+
+  time = ts.tv_sec;
+#if defined(CONFIG_SYSLOG_TIMESTAMP_LOCALTIME)
+  tm = localtime(&time);
+#else
+  tm = gmtime(&time);

Review comment:
       Done.

##########
File path: drivers/syslog/vsyslog.c
##########
@@ -132,8 +133,29 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap)
 #if defined(CONFIG_SYSLOG_TIMESTAMP)
   /* Pre-pend the message with the current time, if available */
 
+#if defined(CONFIG_SYSLOG_TIMESTAMP_FORMATED)
+  time_t time;
+  struct tm * tm;
+  char date_buf[CONFIG_SYSLOG_TIMESTAMP_BUFFER];
+
+  time = ts.tv_sec;
+#if defined(CONFIG_SYSLOG_TIMESTAMP_LOCALTIME)
+  tm = localtime(&time);

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.

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